diff --git a/.env.example b/.env.example
index 8921cd4e5..7e6c81459 100644
--- a/.env.example
+++ b/.env.example
@@ -99,6 +99,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 221886737..c852e707b 100644
--- a/config/app.php
+++ b/config/app.php
@@ -1053,6 +1053,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 496afe3c3..944329557 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 27bbd1be9..35724b742 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;
@@ -2146,7 +2151,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 b472c5fd9..620e40553 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');
@@ -315,6 +320,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 705073b91..9003ae359 100644
--- a/modules/core/site.css
+++ b/modules/core/site.css
@@ -699,6 +699,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 afbffcccd..1f0db790b 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;
}
@@ -1052,6 +1056,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'); };
@@ -1447,7 +1452,7 @@ var Hm_Utils = {
var results = {}
var i;
var hash = window.location.hash;
- var sections = ['.wp_notifications_setting', '.github_all_setting', '.tfa_setting', '.sent_setting', '.general_setting', '.unread_setting', '.flagged_setting', '.all_setting', '.email_setting', '.junk_setting', '.trash_setting', '.drafts_setting','.tag_setting'];
+ var sections = ['.wp_notifications_setting', '.github_all_setting', '.tfa_setting', '.sent_setting', '.general_setting', '.unread_setting', '.flagged_setting', '.all_setting', '.email_setting', '.junk_setting', '.snoozed_setting', '.trash_setting', '.drafts_setting','.tag_setting'];
for (i=0;i $callback, '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('callback' => $callback, '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 6bce45a0b..c4332b225 100644
--- a/modules/imap/handler_modules.php
+++ b/modules/imap/handler_modules.php
@@ -1607,6 +1607,9 @@ public function process() {
case 'junk':
$callback = 'imap_folder_content';
break;
+ case 'snoozed':
+ $callback = 'imap_folder_content';
+ break;
case 'trash':
$callback = 'imap_folder_content';
break;
@@ -1624,7 +1627,7 @@ public function process() {
if ($callback != 'imap_background_unread_content') {
$this->out('move_copy_controls', true);
}
- if (in_array($path, ['sent', 'junk', 'trash', 'drafts'])) {
+ if (in_array($path, ['sent', 'junk', 'snoozed','trash', 'drafts'])) {
foreach (imap_sources($callback, $this, $path) as $vals) {
$this->append('data_sources', $vals);
}
diff --git a/modules/imap/site.js b/modules/imap/site.js
index 81aa5e56e..f250f93d0 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');
}
};