Skip to content

Commit

Permalink
(js) Fix references to mail accounts in popup
Browse files Browse the repository at this point in the history
Fixes #4838
  • Loading branch information
cgx committed Oct 7, 2019
1 parent 1413685 commit 17d3d44
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions UI/WebServerResources/js/Mailer/Mailer.popup.js
Expand Up @@ -103,9 +103,9 @@

if ($window &&
$window.opener &&
$window.opener.$mailboxController) {
$window.opener.mailAccounts) {
// Mail accounts are available from the parent window
accounts = $window.opener.$mailboxController.accounts;
accounts = Account.$findAll($window.opener.mailAccounts);
return $q.when(accounts);
}
else {
Expand All @@ -132,9 +132,22 @@
*/
stateAccount.$inject = ['$stateParams', 'stateAccounts'];
function stateAccount($stateParams, stateAccounts) {
return _.find(stateAccounts, function(account) {
var account, mailboxes;

account = _.find(stateAccounts, function(account) {
return account.id == $stateParams.accountId;
});
if (account) {
// Fetch mailboxes
mailboxes = account.$getMailboxes();
return mailboxes.then(function () {
return account;
});
}
else {
// Account not found
return $q.reject("Account " + $stateParams.accountId + " doesn't exist");
}
}

/**
Expand Down Expand Up @@ -170,7 +183,7 @@
}
else
// Mailbox not found
return $q.reject("Mailbox doesn't exist");
return $q.reject("Mailbox " + mailboxId + " doesn't exist");
}

/**
Expand Down

0 comments on commit 17d3d44

Please sign in to comment.