mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-02 21:52:19 +00:00
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user