(js, html) Fix IMAP folder subscriptions manager

Fixes #3865
This commit is contained in:
Francis Lachapelle
2016-11-08 15:20:41 -05:00
parent ea64046df2
commit 62a3057633
5 changed files with 18 additions and 19 deletions
@@ -131,7 +131,7 @@
return Account.$q.when(this.$mailboxes);
}
else {
return Account.$Mailbox.$find(this).then(function(data) {
return Account.$Mailbox.$find(this, options).then(function(data) {
_this.$mailboxes = data;
_this.$expanded = false;
@@ -81,10 +81,10 @@
* @return a promise of the HTTP operation
* @see {@link Account.$getMailboxes}
*/
Mailbox.$find = function(account) {
Mailbox.$find = function(account, options) {
var path, futureMailboxData;
if (account.fetchAll)
if (options && options.all)
futureMailboxData = this.$$resource.fetch(account.id.toString(), 'viewAll');
else
futureMailboxData = this.$$resource.fetch(account.id.toString(), 'view');
@@ -909,14 +909,14 @@
};
/**
* @function $toggleSubscribe
* @function $updateSubscribe
* @memberof Mailbox.prototype
* @desc Subscribe or unsubscribe to a mailbox
* @desc Update mailbox subscription state with server.
*/
Mailbox.prototype.$toggleSubscribe = function() {
if (this.subscribed)
return Mailbox.$$resource.post(this.id, 'subscribe');
Mailbox.prototype.$updateSubscribe = function() {
var action = this.subscribed? 'subscribe' : 'unsubscribe';
Mailbox.$$resource.post(this.id, action);
};
return Mailbox.$$resource.post(this.id, 'unsubscribe');
};
})();
@@ -210,12 +210,10 @@
});
vm.close = close;
vm.account.$getMailboxes().then(function() {
vm.account.$getMailboxes({ reload: true, all: true }).then(function() {
vm.loading = false;
});
function close() {
$mdDialog.cancel();
}