Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UI] modules.php : Modify the text to explain that Cypht supports JMAP (RFC8621) by default. #1277

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Bienvenumoringa
Copy link
Member

Related task

Modify the text in the help section to explain that Cypht supports the JMAP (RFC8621) protocol in addition to IMAP and SMTP, and make JMAP available by default in standalone Cypht installations or those integrated with Tiki.

image

@@ -80,6 +81,9 @@ public function process() {
if (data_source_available($modules, 'smtp')) {
$smtp_servers = count(Hm_SMTP_List::dump(false));
}
if (data_source_available($modules, 'jmap')) {
$jmap_servers = count(Hm_IMAP_List::dump(false));
Copy link
Member

@Shadow243 Shadow243 Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you will get imap servers too, i mean it will combine imap ad jmap. If soo then we don't need to add an other link for jmap.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the first idea it was already well started, it was rather necessary to apply the filter here: https://github.com/cypht-org/cypht/blob/master/modules/nux/modules.php#L64 without forgetting in this case to do it for this too: https://github.com/cypht-org/cypht/blob/master/modules/nux/modules.php#L75

@Shadow243
Copy link
Member

Shadow243 commented Oct 22, 2024

Screenshot 2024-10-22 at 15 49 52

You don't need to repeat it after SMTP. it's already okay after IMAP as it's an imap alternative, like this:
Screenshot 2024-10-22 at 19 07 46

you can use a cndition like this:

$res .= sprintf(
                        $this->trans('You have %d %s%s'),
                        $server_data[$proto],
                        mb_strtoupper($proto_dsp),
                        ($proto === 'imap' ? ' / JMAP ' . $server_data['jmap'] . ($server_data[$proto] > 1 ? ' sources' : ' source') : ($server_data[$proto] > 1 ? ' sources' : ' source'))
                    );

and filter from here:

if (data_source_available($modules, 'imap')) {
            $imap_servers = count(array_filter(Hm_IMAP_List::dump(false), function($v) { return !array_key_exists('type', $v);}));
            $jmap_servers = count(array_filter(Hm_IMAP_List::dump(false), function($v) { return array_key_exists('type', $v) && $v['type'] == 'jmap'; }));
        }
$this->out('nux_server_setup', array(
            'imap' => $imap_servers,
            'jmap' => $jmap_servers,
            'feeds' => $feed_servers,
            'smtp' => $smtp_servers,
            'profiles' => $profiles
        ));

@Bienvenumoringa
Copy link
Member Author

Screenshot 2024-10-22 at 15 49 52 You don't need to repeat it after SMTP. it's already okay after IMAP as it's an` imap` alternative, like this: Screenshot 2024-10-22 at 19 07 46

you can use a cndition like this:

$res .= sprintf(
                        $this->trans('You have %d %s%s'),
                        $server_data[$proto],
                        mb_strtoupper($proto_dsp),
                        ($proto === 'imap' ? ' / JMAP ' . $server_data['jmap'] . ($server_data[$proto] > 1 ? ' sources' : ' source') : ($server_data[$proto] > 1 ? ' sources' : ' source'))
                    );

and filter from here:

if (data_source_available($modules, 'imap')) {
            $imap_servers = count(array_filter(Hm_IMAP_List::dump(false), function($v) { return !array_key_exists('type', $v);}));
            $jmap_servers = count(array_filter(Hm_IMAP_List::dump(false), function($v) { return array_key_exists('type', $v) && $v['type'] == 'jmap'; }));
        }
$this->out('nux_server_setup', array(
            'imap' => $imap_servers,
            'jmap' => $jmap_servers,
            'feeds' => $feed_servers,
            'smtp' => $smtp_servers,
            'profiles' => $profiles
        ));

apply changers

Copy link
Member

@Shadow243 Shadow243 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more change and we are done. Make sure you rebase too to make selenium test working

modules/nux/modules.php Outdated Show resolved Hide resolved
@@ -592,12 +597,12 @@ protected function output() {
$res .= sprintf(' <a href="?page=servers#%s_section">%s</a>', $proto, $this->trans('Add'));
}
else {
if ($server_data[$proto] > 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will need this if check to support the s for exemple source and sources

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is already resolved here ($server_data[$proto] > 1 ? 'sources' : 'source') and here ($server_data[$proto] > 1 ? 'sources' : 'source').

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants