From 499e99184dc71987efddbf5ef62922a0e1b0909f Mon Sep 17 00:00:00 2001 From: Yannick nsenga romeo Date: Wed, 20 Nov 2024 23:13:14 +0200 Subject: [PATCH] Fix email preview after sending --- .env.example | 1 + config/app.php | 7 +++++++ lib/environment.php | 1 + modules/imap/handler_modules.php | 6 +++--- modules/imap/output_modules.php | 6 ++++-- tests/selenium/settings.py | 4 ++++ 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index 8921cd4e5..899e8bab8 100644 --- a/.env.example +++ b/.env.example @@ -94,6 +94,7 @@ DEFAULT_SETTING_IMAP_PER_PAGE=20 DEFAULT_SETTING_SIMPLE_MSG_PARTS=false DEFAULT_SETTING_PAGINATE_LINKS=true DEFAULT_SETTING_MSG_PART_ICONS=true +DEFAULT_SETTING_REVIEW_SENT_EMAIL=true DEFAULT_SETTING_TEXT_ONLY=false DEFAULT_SETTING_SENT_PER_SOURCE=20 DEFAULT_SETTING_SENT_SINCE='-1 week' diff --git a/config/app.php b/config/app.php index 221886737..1a2b1f285 100644 --- a/config/app.php +++ b/config/app.php @@ -1018,6 +1018,13 @@ */ 'default_setting_msg_part_icons' => env('DEFAULT_SETTING_MSG_PART_ICONS', true), + /* + | + | Show the message after sending + | Defaults to true + */ + 'default_setting_review_sent_email' => env('DEFAULT_SETTING_REVIEW_SENT_EMAIL', true), + /* | | Prefer text parts when viewing a message diff --git a/lib/environment.php b/lib/environment.php index 496afe3c3..183ec3cf9 100644 --- a/lib/environment.php +++ b/lib/environment.php @@ -65,6 +65,7 @@ public function define_default_constants($config) { define('DEFAULT_SIMPLE_MSG_PARTS', $config->get('default_setting_simple_msg_parts', false)); define('DEFAULT_MSG_PART_ICONS', $config->get('default_setting_msg_part_icons', true)); define('DEFAULT_PAGINATION_LINKS', $config->get('default_setting_pagination_links', true)); + define('DEFAULT_REVIEW_SENT_EMAIL', $config->get('default_setting_review_sent_email', true)); define('DEFAULT_TEXT_ONLY', $config->get('default_setting_text_only', false)); define('DEFAULT_NO_PASSWORD_SAVE', $config->get('default_setting_no_password_save', false)); define('DEFAULT_SHOW_LIST_ICONS', $config->get('default_setting_show_list_icons', true)); diff --git a/modules/imap/handler_modules.php b/modules/imap/handler_modules.php index 9accf9126..68376bd33 100644 --- a/modules/imap/handler_modules.php +++ b/modules/imap/handler_modules.php @@ -364,7 +364,7 @@ public function process() { break; } } - if ($uid && $this->user_config->get('review_sent_email_setting', false)) { + if ($uid && $this->user_config->get('review_sent_email_setting', true)) { $this->out('redirect_url', '?page=message&uid='.$uid.'&list_path=imap_'.$imap_id.'_'.bin2hex($sent_folder)); } } @@ -414,7 +414,7 @@ public function process() { } } } - if ($this->get('msg_next_link') && !$this->user_config->get('review_sent_email_setting', false)) { + if ($this->get('msg_next_link') && !$this->user_config->get('review_sent_email_setting', true)) { $this->out('redirect_url', htmlspecialchars_decode($this->get('msg_next_link'))); } } @@ -2086,7 +2086,7 @@ public function process() { function review_sent_email_callback($val) { return $val; } - process_site_setting('review_sent_email', $this, 'review_sent_email_callback', false, true); + process_site_setting('review_sent_email', $this, 'review_sent_email_callback', DEFAULT_REVIEW_SENT_EMAIL, true); } } diff --git a/modules/imap/output_modules.php b/modules/imap/output_modules.php index 1c3438c88..c22825cc3 100644 --- a/modules/imap/output_modules.php +++ b/modules/imap/output_modules.php @@ -1298,13 +1298,15 @@ protected function output() { $checked = ''; $reset = ''; $settings = $this->get('user_settings', array()); - if (array_key_exists('review_sent_email', $settings) && $settings['review_sent_email']) { + if (!array_key_exists('review_sent_email', $settings) || (array_key_exists('review_sent_email', $settings) && $settings['review_sent_email'])) { $checked = ' checked="checked"'; + } + if($settings['review_sent_email'] !== DEFAULT_REVIEW_SENT_EMAIL) { $reset = ''; } return ''. - ''.$reset.''; + ''.$reset.''; } } diff --git a/tests/selenium/settings.py b/tests/selenium/settings.py index 86470a0c7..cfbafe29d 100644 --- a/tests/selenium/settings.py +++ b/tests/selenium/settings.py @@ -120,6 +120,9 @@ def msg_list_icons_test(self): def msg_part_icons_test(self): self.checkbox_test('general_setting', 'msg_part_icons', True) + def review_sent_email_test(self): + self.checkbox_test('general_setting', 'review_sent_email', True) + def simple_msg_parts_test(self): self.checkbox_test('general_setting', 'simple_msg_parts', False) @@ -228,6 +231,7 @@ def github_max_per_source_test(self): 'msg_list_icons_test', 'msg_part_icons_test', 'simple_msg_parts_test', + 'review_sent_email_test', 'text_only_test', 'disable_delete_prompt_test', 'no_password_save_test',