Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(mail(js)): unselect all messages when changing mailbox
Fixes #4970
Fixes #5148
  • Loading branch information
cgx committed Apr 14, 2021
1 parent bed91ce commit bfbf43b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions UI/WebServerResources/js/Mailer/Mailbox.service.js
Expand Up @@ -302,6 +302,17 @@
return this.$selectedMessages().length;
};

/**
* @function $unselectMessages
* @memberof Mailbox.prototype
* @desc Unselect all messages.
*/
Mailbox.prototype.$unselectMessages = function() {
_.forEach(this.$selectedMessages(), function(message) {
message.selected = false;
});
};

/**
* @function isSelectedMessage
* @memberof Mailbox.prototype
Expand Down
4 changes: 3 additions & 1 deletion UI/WebServerResources/js/Mailer/Mailer.app.js
Expand Up @@ -255,11 +255,13 @@
if (Mailbox.$virtualMode)
return [];

if (stateMailbox)
if (stateMailbox) {
stateMailbox.$unselectMessages();
promise = stateMailbox.$filter().catch(function() {
// Mailbox not found
return $q.reject('Mailbox not found');
});
}
else
promise = $q.reject("Mailbox doesn't exist");

Expand Down

0 comments on commit bfbf43b

Please sign in to comment.