Skip to content

Commit

Permalink
Merge pull request #1374 from cypht-org/review-sent-email
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadow243 authored Nov 21, 2024
2 parents b5b97f5 + 499e991 commit 4a78bfd
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
7 changes: 7 additions & 0 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions modules/imap/handler_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand Down Expand Up @@ -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')));
}
}
Expand Down Expand Up @@ -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);
}
}

Expand Down
6 changes: 4 additions & 2 deletions modules/imap/output_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<span class="tooltip_restore" restore_aria_label="Restore default value"><i class="bi bi-arrow-repeat refresh_list reset_default_value_checkbox"></i></span>';
}
return '<tr class="general_setting"><td><label class="form-check-label" for="review_sent_email">'.
$this->trans('Review sent message').'</label></td>'.
'<td><input class="form-check-input" type="checkbox" '.$checked.' id="review_sent_email" name="review_sent_email" data-default-value="false" value="1" />'.$reset.'</td></tr>';
'<td><input class="form-check-input" type="checkbox" '.$checked.' id="review_sent_email" name="review_sent_email" data-default-value="'.(DEFAULT_REVIEW_SENT_EMAIL ? 'true' : 'false') . '" value="1" />'.$reset.'</td></tr>';
}
}

Expand Down
4 changes: 4 additions & 0 deletions tests/selenium/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 4a78bfd

Please sign in to comment.