Skip to content

Commit

Permalink
(js) Fix page reload with external IMAP account
Browse files Browse the repository at this point in the history
Fixes #4709
  • Loading branch information
cgx committed Mar 22, 2019
1 parent 96bcbbd commit c50f229
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -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
Expand Down
15 changes: 12 additions & 3 deletions UI/WebServerResources/js/Mailer/Account.service.js
Expand Up @@ -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);
};

/**
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -174,6 +182,7 @@

return _this.$mailboxes;
});
return this.$futureMailboxesData;
}
};

Expand Down
22 changes: 12 additions & 10 deletions UI/WebServerResources/js/Mailer/Mailer.app.js
Expand Up @@ -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 });
}
});
}

/**
Expand Down

0 comments on commit c50f229

Please sign in to comment.