(js, html) Fix IMAP folder subscriptions manager

Fixes #3865
pull/225/head
Francis Lachapelle 2016-11-08 15:20:41 -05:00
parent ea64046df2
commit 62a3057633
5 changed files with 18 additions and 19 deletions

1
NEWS
View File

@ -14,6 +14,7 @@ Bug fixes
- [web] fixed mail settings persistence when sorting by arrival date
- [web] disable submit button while saving an event or a task (#3880)
- [web] fixed computation of week number
- [web] fixed and improved IMAP folder subscriptions manager (#3865)
3.2.1 (2016-11-02)
------------------

View File

@ -28,9 +28,9 @@
md-mode="indeterminate"><!-- progress --></md-progress-circular>
</div>
<md-list>
<md-list-item ng-repeat="folder in subscriptions.account.$flattenMailboxes({all: true }) | filter:subscriptions.filter"
md-item-size="48"
ng-hide="subscriptions.metadataForFolder(folder).special">
<md-list-item
ng-repeat="folder in subscriptions.account.$flattenMailboxes({all: true}) | filter:subscriptions.filter"
md-item-size="48">
<div ng-class="'sg-child-level-' + folder.level">
<md-icon>{{subscriptions.metadataForFolder(folder).icon}}</md-icon>
</div>
@ -38,11 +38,11 @@
{{subscriptions.metadataForFolder(folder).name}}
</p>
<md-checkbox class="md-secondary"
ng-disabled="subscriptions.metadataForFolder(folder).special"
ng-model="folder.subscribed"
ng-click="folder.$toggleSubscribe()"
ng-change="folder.$updateSubscribe()"
ng-true-value="1"
ng-false-value="0">
</md-checkbox>
ng-false-value="0"><!-- subscribed --></md-checkbox>
</md-list-item>
</md-list>
</md-dialog-content>

View File

@ -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;

View File

@ -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');
};
})();

View File

@ -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();
}