mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-06-23 19:04:18 +00:00
fix(mail(js)): don't load mailboxes list from popup editor
This commit is contained in:
@@ -130,19 +130,15 @@
|
||||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
stateAccount.$inject = ['$stateParams', 'stateAccounts'];
|
||||
function stateAccount($stateParams, stateAccounts) {
|
||||
var account, mailboxes;
|
||||
stateAccount.$inject = ['$q', '$stateParams', 'stateAccounts'];
|
||||
function stateAccount($q, $stateParams, stateAccounts) {
|
||||
var account;
|
||||
|
||||
account = _.find(stateAccounts, function(account) {
|
||||
return account.id == $stateParams.accountId;
|
||||
});
|
||||
if (account) {
|
||||
// Fetch mailboxes
|
||||
mailboxes = account.$getMailboxes();
|
||||
return mailboxes.then(function () {
|
||||
return account;
|
||||
});
|
||||
return $q.when(account);
|
||||
}
|
||||
else {
|
||||
// Account not found
|
||||
@@ -153,12 +149,24 @@
|
||||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
stateMailbox.$inject = ['$q', '$state', '$stateParams', 'stateAccount', 'decodeUriFilter', 'Mailbox'];
|
||||
function stateMailbox($q, $state, $stateParams, stateAccount, decodeUriFilter, Mailbox) {
|
||||
var mailbox,
|
||||
stateMailbox.$inject = ['$q', '$window', '$state', '$stateParams', 'stateAccount', 'decodeUriFilter', 'Mailbox'];
|
||||
function stateMailbox($q, $window, $state, $stateParams, stateAccount, decodeUriFilter, Mailbox) {
|
||||
var mailbox = null,
|
||||
futureMailbox = null,
|
||||
mailboxId = decodeUriFilter($stateParams.mailboxId),
|
||||
_find;
|
||||
|
||||
if ($window.opener) {
|
||||
if ('$mailboxController' in $window.opener &&
|
||||
'selectedFolder' in $window.opener.$mailboxController &&
|
||||
'account' in $window.opener.$mailboxController &&
|
||||
$window.opener.$mailboxController.account.id == stateAccount.id &&
|
||||
$window.opener.$mailboxController.selectedFolder.path == mailboxId) {
|
||||
// The message mailbox is opened in the parent window
|
||||
mailbox = $window.opener.$mailboxController.selectedFolder;
|
||||
}
|
||||
}
|
||||
|
||||
// Recursive find function
|
||||
_find = function(mailboxes) {
|
||||
var mailbox = _.find(mailboxes, function(o) {
|
||||
@@ -174,16 +182,23 @@
|
||||
return mailbox;
|
||||
};
|
||||
|
||||
mailbox = _find(stateAccount.$mailboxes);
|
||||
|
||||
if (mailbox) {
|
||||
futureMailbox = $q.when(mailbox);
|
||||
}
|
||||
else {
|
||||
futureMailbox = stateAccount.$getMailboxes().then(function(mailboxes) {
|
||||
return _find(mailboxes);
|
||||
});
|
||||
}
|
||||
|
||||
return futureMailbox.then(function(mailbox) {
|
||||
mailbox.$topIndex = 0;
|
||||
mailbox.selectFolder();
|
||||
return mailbox;
|
||||
}
|
||||
else
|
||||
}, function() {
|
||||
// Mailbox not found
|
||||
return $q.reject("Mailbox " + mailboxId + " doesn't exist");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user