(js) Fix scrolling when deleting a message

pull/253/head
Francis Lachapelle 2019-05-16 13:53:43 -04:00
parent a4e44e1e65
commit 05ca00296d
2 changed files with 9 additions and 5 deletions

1
NEWS
View File

@ -16,6 +16,7 @@ Bug fixes
- [web] improved detection of URLs and email addresses in text mail parts
- [web] fixed page reload with external IMAP account (#4709)
- [web] constrained absolute-positioned child elements of HTML mail parts
- [web] fixed useless scrolling when deleting a message
- [core] allow super users to modify any event (#4216)
- [core] correctly handle the full cert chain in S/MIME
- [core] handle multidays events in freebusy data

View File

@ -314,7 +314,8 @@
this.deleteMessage = function() {
var mailbox, message, state, nextMessage, previousMessage,
parentCtrls = $parentControllers();
parentCtrls = $parentControllers(),
$timeout = this.service.$timeout;
if (parentCtrls.messageCtrl) {
mailbox = parentCtrls.mailboxCtrl.selectedFolder;
@ -360,10 +361,12 @@
state.go('mail.account.virtualMailbox.message', {mailboxId: encodeUriFilter(nextMessage.$mailbox.path), messageId: nextMessage.uid});
else
state.go('mail.account.mailbox.message', {messageId: nextMessage.uid});
if (nextIndex < mailbox.$topIndex)
mailbox.$topIndex = nextIndex;
else if (nextIndex > mailbox.$lastVisibleIndex)
mailbox.$topIndex = nextIndex - (mailbox.$lastVisibleIndex - mailbox.$topIndex);
$timeout(function() {
if (nextIndex < mailbox.$topIndex)
mailbox.$topIndex = nextIndex;
else if (nextIndex > mailbox.$lastVisibleIndex)
mailbox.$topIndex = nextIndex - (mailbox.$lastVisibleIndex - mailbox.$topIndex);
});
}
else {
state.go('mail.account.mailbox').then(function() {