diff --git a/.env.example b/.env.example
index c51d242ae..31fbaf5b7 100644
--- a/.env.example
+++ b/.env.example
@@ -100,6 +100,8 @@ DEFAULT_SETTING_SENT_PER_SOURCE=20
DEFAULT_SETTING_SENT_SINCE='-1 week'
DEFAULT_SETTING_JUNK_PER_SOURCE=20
DEFAULT_SETTING_JUNK_SINCE='-1 week'
+DEFAULT_SETTING_SNOOZED_PER_SOURCE=20
+DEFAULT_SETTING_SNOOZED_SINCE='-1 week'
DEFAULT_SETTING_TAGS_PER_SOURCE=20
DEFAULT_SETTING_TAGS_SINCE='-1 week'
DEFAULT_SETTING_TRASH_PER_SOURCE=20
diff --git a/config/app.php b/config/app.php
index 1a2b1f285..bef57f60b 100644
--- a/config/app.php
+++ b/config/app.php
@@ -1060,6 +1060,20 @@
*/
'default_setting_junk_per_source' => env('DEFAULT_SETTING_JUNK_PER_SOURCE', 20),
+ /*
+ |
+ | Per source time limit for snoozed page
+ | Defaults to 1 week
+ */
+ 'default_setting_snoozed_since' => env('DEFAULT_SETTING_SNOOZED_SINCE', '-1 week'),
+
+ /*
+ |
+ | Per source number limit for snoozed page
+ | Defaults 20
+ */
+ 'default_setting_snoozed_per_source' => env('DEFAULT_SETTING_SNOOZED_PER_SOURCE', 20),
+
/*
|
| Per source time limit for tags page
diff --git a/lib/environment.php b/lib/environment.php
index 183ec3cf9..895a6b9da 100644
--- a/lib/environment.php
+++ b/lib/environment.php
@@ -56,6 +56,8 @@ public function define_default_constants($config) {
define('DEFAULT_IMAP_PER_PAGE', $config->get('default_setting_imap_per_page', 20));
define('DEFAULT_JUNK_SINCE', $config->get('default_setting_junk_since', '-1 week'));
define('DEFAULT_JUNK_PER_SOURCE', $config->get('default_setting_junk_per_source', 20));
+ define('DEFAULT_SNOOZED_SINCE', $config->get('default_setting_snoozed_since', '-1 week'));
+ define('DEFAULT_SNOOZED_PER_SOURCE', $config->get('default_setting_snoozed_per_source', 20));
define('DEFAULT_TAGS_SINCE', $config->get('default_setting_tags_since', '-1 week'));
define('DEFAULT_TAGS_PER_SOURCE', $config->get('default_setting_tags_per_source', 20));
define('DEFAULT_TRASH_SINCE', $config->get('default_setting_trash_since', '-1 week'));
diff --git a/modules/core/handler_modules.php b/modules/core/handler_modules.php
index 17e837a03..ad540c247 100644
--- a/modules/core/handler_modules.php
+++ b/modules/core/handler_modules.php
@@ -397,6 +397,32 @@ public function process() {
}
}
+/**
+ * Process input from the max per source setting for the Snoozed page in the settings page
+ * @subpackage core/handler
+ */
+class Hm_Handler_process_snoozed_source_max_setting extends Hm_Handler_Module {
+ /**
+ * Allowed values are greater than zero and less than MAX_PER_SOURCE
+ */
+ public function process() {
+ process_site_setting('snoozed_per_source', $this, 'max_source_setting_callback', DEFAULT_SNOOZED_PER_SOURCE);
+ }
+}
+
+/**
+ * Process "since" setting for the Snoozed page in the settings page
+ * @subpackage core/handler
+ */
+class Hm_Handler_process_snoozed_since_setting extends Hm_Handler_Module {
+ /**
+ * valid values are defined in the process_since_argument function
+ */
+ public function process() {
+ process_site_setting('snoozed_since', $this, 'since_setting_callback', DEFAULT_SNOOZED_SINCE);
+ }
+}
+
/**
* Process "since" setting for the Everything page in the settings page
* @subpackage core/handler
diff --git a/modules/core/message_list_functions.php b/modules/core/message_list_functions.php
index 793bc398d..a54375c43 100644
--- a/modules/core/message_list_functions.php
+++ b/modules/core/message_list_functions.php
@@ -50,6 +50,12 @@ function get_message_list_settings($path, $handler) {
$per_source_limit = $handler->user_config->get('junk_per_source_setting', DEFAULT_JUNK_PER_SOURCE);
$mailbox_list_title = array('Junk');
}
+ elseif ($path == 'snoozed') {
+ $list_path = 'snoozed';
+ $message_list_since = $handler->user_config->get('snoozed_since_setting', DEFAULT_SNOOZED_SINCE);
+ $per_source_limit = $handler->user_config->get('snoozed_per_source_setting', DEFAULT_SNOOZED_PER_SOURCE);
+ $mailbox_list_title = array('Snoozed');
+ }
elseif ($path == 'trash') {
$list_path = 'trash';
$message_list_since = $handler->user_config->get('trash_since_setting', DEFAULT_TRASH_SINCE);
diff --git a/modules/core/output_modules.php b/modules/core/output_modules.php
index 4225ea1c2..da6d14f08 100644
--- a/modules/core/output_modules.php
+++ b/modules/core/output_modules.php
@@ -1384,6 +1384,11 @@ protected function output() {
$res .= '';
}
$res .= ''.$this->trans('Drafts').'';
+ $res .= '
';
if ($this->format == 'HTML5') {
return $res;
@@ -2136,7 +2141,62 @@ protected function output() {
''.message_since_dropdown($since, 'trash_since', $this, DEFAULT_TRASH_SINCE).' | ';
}
}
-
+/**
+ * Starts the Snoozed section on the settings page
+ * @subpackage core/output
+ */
+class Hm_Output_start_snoozed_settings extends Hm_Output_Module {
+ /**
+ * Settings in this section control the snoozed messages view
+ */
+ protected function output() {
+ return ''.
+ ''.
+ $this->trans('Snoozed').' |
';
+ }
+}
+/**
+ * Option for the maximum number of messages per source for the Snoozed page
+ * @subpackage core/output
+ */
+class Hm_Output_snoozed_source_max_setting extends Hm_Output_Module {
+ /**
+ * Processed by Hm_Handler_process_snoozed_source_max_setting
+ */
+ protected function output() {
+ $sources = DEFAULT_SNOOZED_PER_SOURCE;
+ $settings = $this->get('user_settings', array());
+ $reset = '';
+ if (array_key_exists('snoozed_per_source', $settings)) {
+ $sources = $settings['snoozed_per_source'];
+ }
+ if ($sources != DEFAULT_SNOOZED_PER_SOURCE) {
+ $reset = '';
+ }
+ return ' | ' .
+ ''.$reset.' |
';
+ }
+}
+/**
+ * Option for the snoozed messages date range
+ * @subpackage core/output
+ */
+class Hm_Output_snoozed_since_setting extends Hm_Output_Module {
+ /**
+ * Processed by Hm_Handler_process_snoozed_since_setting
+ */
+ protected function output() {
+ $since = DEFAULT_SNOOZED_SINCE;
+ $settings = $this->get('user_settings', array());
+ if (array_key_exists('snoozed_since', $settings) && $settings['snoozed_since']) {
+ $since = $settings['snoozed_since'];
+ }
+ return ' | '.
+ ''.message_since_dropdown($since, 'snoozed_since', $this, DEFAULT_SNOOZED_SINCE).' |
';
+ }
+}
/**
* Starts the Draft section on the settings page
* @subpackage core/output
diff --git a/modules/core/setup.php b/modules/core/setup.php
index 9aeaf22db..3e3e371e4 100644
--- a/modules/core/setup.php
+++ b/modules/core/setup.php
@@ -50,6 +50,8 @@
add_handler('settings', 'process_all_email_source_max_setting', true, 'core', 'date', 'after');
add_handler('settings', 'process_junk_since_setting', true, 'core', 'date', 'after');
add_handler('settings', 'process_junk_source_max_setting', true, 'core', 'date', 'after');
+add_handler('settings', 'process_snoozed_since_setting', true, 'core', 'date', 'after');
+add_handler('settings', 'process_snoozed_source_max_setting', true, 'core', 'date', 'after');
add_handler('settings', 'process_trash_since_setting', true, 'core', 'date', 'after');
add_handler('settings', 'process_trash_source_max_setting', true, 'core', 'date', 'after');
add_handler('settings', 'process_drafts_since_setting', true, 'core', 'date', 'after');
@@ -89,7 +91,10 @@
add_output('settings', 'start_junk_settings', true, 'core', 'flagged_source_max_setting', 'after');
add_output('settings', 'junk_since_setting', true, 'core', 'start_junk_settings', 'after');
add_output('settings', 'junk_source_max_setting', true, 'core', 'junk_since_setting', 'after');
-add_output('settings', 'start_trash_settings', true, 'core', 'junk_source_max_setting', 'after');
+add_output('settings', 'start_snoozed_settings', true, 'core', 'junk_source_max_setting', 'after');
+add_output('settings', 'snoozed_since_setting', true, 'core', 'start_snoozed_settings', 'after');
+add_output('settings', 'snoozed_source_max_setting', true, 'core', 'snoozed_since_setting', 'after');
+add_output('settings', 'start_trash_settings', true, 'core', 'snoozed_source_max_setting', 'after');
add_output('settings', 'trash_since_setting', true, 'core', 'start_trash_settings', 'after');
add_output('settings', 'trash_source_max_setting', true, 'core', 'trash_since_setting', 'after');
add_output('settings', 'start_drafts_settings', true, 'core', 'trash_source_max_setting', 'after');
@@ -319,6 +324,8 @@
'stay_logged_in' => FILTER_VALIDATE_BOOLEAN,
'junk_per_source' => FILTER_VALIDATE_INT,
'junk_since' => FILTER_DEFAULT,
+ 'snoozed_per_source' => FILTER_VALIDATE_INT,
+ 'snoozed_since' => FILTER_DEFAULT,
'trash_per_source' => FILTER_VALIDATE_INT,
'trash_since' => FILTER_DEFAULT,
'drafts_per_source' => FILTER_DEFAULT,
diff --git a/modules/core/site.css b/modules/core/site.css
index 95e98e0f8..fa2037fc9 100644
--- a/modules/core/site.css
+++ b/modules/core/site.css
@@ -694,6 +694,7 @@ button {
.flagged_setting,
.general_setting,
.junk_setting,
+.snoozed_setting,
.trash_setting,
.drafts_setting,
.privacy_setting {
diff --git a/modules/core/site.js b/modules/core/site.js
index cb42a5cac..81713db38 100644
--- a/modules/core/site.js
+++ b/modules/core/site.js
@@ -477,6 +477,7 @@ function Message_List() {
'unread': 'formatted_unread_data',
'flagged': 'formatted_flagged_data',
'junk': 'formatted_junk_data',
+ 'snoozed': 'formatted_snoozed_data',
'trash': 'formatted_trash_data',
'sent': 'formatted_sent_data',
'drafts': 'formatted_drafts_data',
@@ -617,6 +618,9 @@ function Message_List() {
if (action_type == 'unflag' && getListPathParam() == 'flagged') {
remove = true;
}
+ if (action_type == 'unsnooze' && getListPathParam() == 'snoozed') {
+ remove = true;
+ }
else if (action_type == 'delete' || action_type == 'archive') {
remove = true;
}
@@ -1056,6 +1060,7 @@ function Message_List() {
this.set_unread_state = function() { self.set_message_list_state('formatted_unread_data'); };
this.set_search_state = function() { self.set_message_list_state('formatted_search_data'); };
this.set_junk_state = function() { self.set_message_list_state('formatted_junk_data'); };
+ this.set_snoozed_state = function() { self.set_message_list_state('formatted_snoozed_data'); };
this.set_trash_state = function() { self.set_message_list_state('formatted_trash_data'); };
this.set_draft_state = function() { self.set_message_list_state('formatted_drafts_data'); };
this.set_tag_state = function() { self.set_message_list_state('formatted_tag_data'); };
diff --git a/modules/imap/functions.php b/modules/imap/functions.php
index 03349bf3a..6a8365484 100644
--- a/modules/imap/functions.php
+++ b/modules/imap/functions.php
@@ -34,6 +34,9 @@ function imap_sources($mod, $folder = 'sent') {
elseif ($inbox) {
$sources[] = array('folder' => bin2hex('INBOX'), 'type' => 'imap', 'name' => $vals['name'], 'id' => $index);
}
+ elseif ($folder=="snoozed"){
+ $sources[] = array('callback' => $callback, 'folder' => bin2hex('Snoozed'), 'type' => 'imap', 'name' => $vals['name'], 'id' => $index);
+ }
else {
$sources[] = array('folder' => bin2hex('SPECIAL_USE_CHECK'), 'nodisplay' => true, 'type' => 'imap', 'name' => $vals['name'], 'id' => $index);
}
diff --git a/modules/imap/handler_modules.php b/modules/imap/handler_modules.php
index 658c1c290..c1c7e0039 100644
--- a/modules/imap/handler_modules.php
+++ b/modules/imap/handler_modules.php
@@ -1650,7 +1650,7 @@ public function process() {
else {
$path = '';
}
- if (in_array($path, ['sent', 'junk', 'trash', 'drafts'])) {
+ if (in_array($path, ['sent', 'junk', 'snoozed','trash', 'drafts'])) {
foreach (imap_sources($this, $path) as $vals) {
$this->append('data_sources', $vals);
}
diff --git a/modules/imap/site.js b/modules/imap/site.js
index 4dbfb7817..e23662094 100644
--- a/modules/imap/site.js
+++ b/modules/imap/site.js
@@ -279,7 +279,7 @@ var add_auto_folder = function(folder) {
};
var cache_folder_data = function() {
- if (['sent', 'drafts', 'junk', 'trash','tag'].includes(getListPathParam())) {
+ if (['sent', 'drafts', 'junk','snoozed', 'trash','tag'].includes(getListPathParam())) {
Hm_Message_List.set_message_list_state('formatted_'+getListPathParam()+'_data');
}
};
diff --git a/tests/phpunit/modules/core/output_modules.php b/tests/phpunit/modules/core/output_modules.php
index 9b953753d..b51252dda 100644
--- a/tests/phpunit/modules/core/output_modules.php
+++ b/tests/phpunit/modules/core/output_modules.php
@@ -865,10 +865,10 @@ public function test_main_menu_content() {
$test = new Output_Test('main_menu_content', 'core');
$test->handler_response = array('folder_sources' => array(array('email_folders', 'baz')));
$res = $test->run();
- $this->assertEquals(array(''), $res->output_response);
+ $this->assertEquals(array(''), $res->output_response);
$test->rtype = 'AJAX';
$res = $test->run();
- $this->assertEquals(array('folder_sources' => array(array('email_folders', 'baz')), 'formatted_folder_list' => ''), $res->output_response);
+ $this->assertEquals(array('folder_sources' => array(array('email_folders', 'baz')), 'formatted_folder_list' => ''), $res->output_response);
}
/**