diff --git a/NEWS b/NEWS index bd0ddc144c..326290cbbc 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,7 @@ Bug fixes - [web] keep center list of Calendar module visible on small screens - [web] check for duplicate name only if address book name is changed - [web] improved detection of URLs and email addresses in text mail parts + - [web] fixed page reload with external IMAP account (#4709) - [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 diff --git a/UI/WebServerResources/js/Mailer/Account.service.js b/UI/WebServerResources/js/Mailer/Account.service.js index 0638aa25a1..abbad4aabc 100644 --- a/UI/WebServerResources/js/Mailer/Account.service.js +++ b/UI/WebServerResources/js/Mailer/Account.service.js @@ -65,12 +65,17 @@ * @returns the list of accounts */ Account.$findAll = function(data) { - if (!data) { + if (data) { + return Account.$unwrapCollection(data); + } + else if (Account.$accounts) { + return Account.$q.when(Account.$accounts); + } + else { return Account.$$resource.fetch('', 'mailAccounts').then(function(o) { return Account.$unwrapCollection(o); }); } - return Account.$unwrapCollection(data); }; /** @@ -133,8 +138,11 @@ if (this.$mailboxes && !(options && options.reload)) { return Account.$q.when(this.$mailboxes); } + else if (this.$futureMailboxesData) { + return this.$futureMailboxesData; + } else { - return Account.$Mailbox.$find(this, options).then(function(data) { + this.$futureMailboxesData = Account.$Mailbox.$find(this, options).then(function(data) { _this.$mailboxes = data; _this.$expanded = false; @@ -174,6 +182,7 @@ return _this.$mailboxes; }); + return this.$futureMailboxesData; } }; diff --git a/UI/WebServerResources/js/Mailer/Mailer.app.js b/UI/WebServerResources/js/Mailer/Mailer.app.js index 2790ef600e..821b71eb62 100644 --- a/UI/WebServerResources/js/Mailer/Mailer.app.js +++ b/UI/WebServerResources/js/Mailer/Mailer.app.js @@ -211,16 +211,18 @@ if (Mailbox.selectedFolder && !Mailbox.$virtualMode) Mailbox.selectedFolder.$isLoading = true; - mailbox = _find(stateAccount.$mailboxes); - - if (mailbox) { - mailbox.$topIndex = 0; - mailbox.selectFolder(); - return mailbox; - } - else - // Mailbox not found - return $q.reject("Mailbox doesn't exist"); + return stateAccount.$getMailboxes().then(function (mailboxes) { + mailbox = _find(mailboxes); + if (mailbox) { + mailbox.$topIndex = 0; + mailbox.selectFolder(); + return mailbox; + } + else { + // Mailbox not found + $state.go('mail.account', { accountId: stateMailbox.$account.id }); + } + }); } /**