Commit 0e4bf6fd authored by Aleksander Machniak's avatar Aleksander Machniak

Fix bug where unread count wasn't updated after moving multi-folder result (#6846)

parent d9e32180
......@@ -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
---------------
......
......@@ -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);
......
......@@ -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) {
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment