diff --git a/CHANGELOG b/CHANGELOG index 2397f03af..23f0bc4e1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -70,6 +70,7 @@ CHANGELOG Roundcube Webmail - Fix bug where selection of columns on messages list wasn't working - Fix bug in converting multi-page Tiff images to Jpeg (#6824) - Fix bug where handling multiple messages from multi-folder search result could not work (#6845) +- Fix bug where unread count wasn't updated after moving multi-folder result (#6846) RELEASE 1.4-rc1 --------------- diff --git a/plugins/archive/archive.php b/plugins/archive/archive.php index 5917fc389..3218b6e25 100644 --- a/plugins/archive/archive.php +++ b/plugins/archive/archive.php @@ -257,6 +257,7 @@ class archive extends rcube_plugin $pages = ceil($msg_count / $page_size); $nextpage_count = $old_count - $page_size * $page; $remaining = $msg_count - $page_size * ($page - 1); + $quota_root = $multifolder ? $this->result['sources'][0] : 'INBOX'; // jump back one page (user removed the whole last page) if ($page > 1 && $remaining == 0) { @@ -266,22 +267,16 @@ class archive extends rcube_plugin $jump_back = true; } + // update unread messages counts for all involved folders + foreach ($this->result['sources'] as $folder) { + rcmail_send_unread_count($folder, true); + } + // update message count display $rcmail->output->set_env('messagecount', $msg_count); $rcmail->output->set_env('current_page', $page); $rcmail->output->set_env('pagecount', $pages); $rcmail->output->set_env('exists', $exists); - - // update mailboxlist - $unseen_count = $msg_count ? $storage->count($mbox, 'UNSEEN') : 0; - $old_unseen = rcmail_get_unseen_count($mbox); - $quota_root = $multifolder ? $this->result['sources'][0] : 'INBOX'; - - if ($old_unseen != $unseen_count) { - $rcmail->output->command('set_unread_count', $mbox, $unseen_count, ($mbox == 'INBOX')); - rcmail_set_unseen_count($mbox, $unseen_count); - } - $rcmail->output->command('set_quota', $rcmail->quota_content(null, $quota_root)); $rcmail->output->command('set_rowcount', rcmail_get_messagecount_text($msg_count), $mbox); diff --git a/program/steps/mail/mark.inc b/program/steps/mail/mark.inc index 4bbb65892..a147d8817 100644 --- a/program/steps/mail/mark.inc +++ b/program/steps/mail/mark.inc @@ -134,21 +134,14 @@ if ($_uids && $flag) { $jump_back = true; } + foreach ($input as $mbox => $uids) { + rcmail_send_unread_count($mbox, true); + } + // update message count display $OUTPUT->set_env('messagecount', $msg_count); $OUTPUT->set_env('current_page', $page); $OUTPUT->set_env('pagecount', $pages); - - // update mailboxlist - $mbox = $RCMAIL->storage->get_folder(); - $unseen_count = $msg_count ? $RCMAIL->storage->count($mbox, 'UNSEEN') : 0; - $old_unseen = rcmail_get_unseen_count($mbox); - - if ($old_unseen != $unseen_count) { - $OUTPUT->command('set_unread_count', $mbox, $unseen_count, ($mbox == 'INBOX')); - rcmail_set_unseen_count($mbox, $unseen_count); - } - $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count), $mbox); if ($threading) { diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc index 2c372992e..a3cfd5f57 100644 --- a/program/steps/mail/move_del.inc +++ b/program/steps/mail/move_del.inc @@ -135,25 +135,20 @@ if ($page > 1 && $remaining == 0) { $jump_back = true; } -// update message count display -$OUTPUT->set_env('messagecount', $msg_count); -$OUTPUT->set_env('current_page', $page); -$OUTPUT->set_env('pagecount', $pages); -$OUTPUT->set_env('exists', $exists); - -// update mailboxlist -$unseen_count = $msg_count ? $RCMAIL->storage->count($mbox, 'UNSEEN') : 0; -$old_unseen = rcmail_get_unseen_count($mbox); - -if ($old_unseen != $unseen_count) { - $OUTPUT->command('set_unread_count', $mbox, $unseen_count, ($mbox == 'INBOX')); - rcmail_set_unseen_count($mbox, $unseen_count); +// update unseen messages counts for all involved folders +foreach ($sources as $source) { + rcmail_send_unread_count($source, true); } if ($RCMAIL->action == 'move' && strlen($target)) { rcmail_send_unread_count($target, true); } +// update message count display +$OUTPUT->set_env('messagecount', $msg_count); +$OUTPUT->set_env('current_page', $page); +$OUTPUT->set_env('pagecount', $pages); +$OUTPUT->set_env('exists', $exists); $OUTPUT->command('set_quota', $RCMAIL->quota_content(null, $multifolder ? $sources[0] : 'INBOX')); $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count), $mbox);