Skip to content

Commit b8c791b

Browse files
committed
fix(frontend,backend): more unread count fixes
1 parent e278ab4 commit b8c791b

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

modules/desktop_notifications/site.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ $(function() {
2323
setInterval(() => {
2424
// undefined_undefined: load with no filter and no keyword
2525
new Hm_MessagesStore('unread', 1, 'undefined_undefined').load(true, true).then((store) => {
26-
$('.total_unread_count').html(' '+store.count+' ');
2726
store.newMessages.forEach((messageRow) => {
2827
triggerNewMessageEvent($(messageRow).data('uid'), $(messageRow)[0]);
2928
});

modules/imap/handler_modules.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,13 @@ public function process() {
12821282

12831283
list($sort, $reverse) = process_sort_arg($this->request->get['sort'], $this->user_config->get('default_sort_order_setting', 'arrival'));
12841284

1285-
switch ($this->get('list_path')) {
1285+
if (isset($this->request->post['list_path'])) {
1286+
$list_path = $this->request->post['list_path'];
1287+
} else {
1288+
$list_path = $this->get('list_path');
1289+
}
1290+
1291+
switch ($list_path) {
12861292
case 'email':
12871293
$filter = 'ALL';
12881294
$limit = $this->user_config->get('all_email_per_source_setting', DEFAULT_ALL_EMAIL_PER_SOURCE);
@@ -1295,14 +1301,14 @@ public function process() {
12951301
break;
12961302
case 'flagged':
12971303
case 'unread':
1298-
$filter = $this->get('list_path') == 'unread' ? 'UNSEEN' : mb_strtoupper($this->get('list_path'));
1304+
$filter = $list_path == 'unread' ? 'UNSEEN' : mb_strtoupper($list_path);
12991305
default:
13001306
if (empty($filter)) {
13011307
$filter = 'ALL';
13021308
}
1303-
if ($this->get('list_path')) {
1304-
$limit = $this->user_config->get($this->get('list_path').'_per_source_setting', DEFAULT_PER_SOURCE);
1305-
$date = process_since_argument($this->user_config->get($this->get('list_path').'_since_setting', DEFAULT_SINCE));
1309+
if ($list_path) {
1310+
$limit = $this->user_config->get($list_path.'_per_source_setting', DEFAULT_PER_SOURCE);
1311+
$date = process_since_argument($this->user_config->get($list_path.'_since_setting', DEFAULT_SINCE));
13061312
} else {
13071313
$limit = $this->user_config->get('all_per_source_setting', DEFAULT_ALL_PER_SOURCE);
13081314
$date = process_since_argument($this->user_config->get('all_since_setting', DEFAULT_SINCE));

modules/imap/site.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,12 +479,10 @@ var setup_imap_folder_page = async function(listPath, listPage = 1) {
479479
await select_imap_folder(listPath, listPage, true)
480480
}
481481

482-
new Hm_MessagesStore('unread', 1, 'undefined_undefined').load(true, true);
483-
484-
// Refresh in the background each 30 seconds and abort any pending request when the page unmounts
482+
// Refresh in the background each 60 seconds
485483
const interval = setInterval(async () => {
486484
select_imap_folder(listPath, 1, true, true);
487-
}, 30000);
485+
}, 60000);
488486

489487
// Return cleanup function to clear interval when page unmounts
490488
return () => {

0 commit comments

Comments
 (0)