Skip to content

Commit

Permalink
(js, html) Fix IMAP folder subscriptions manager
Browse files Browse the repository at this point in the history
Fixes #3865
  • Loading branch information
cgx committed Nov 8, 2016
1 parent ea64046 commit 62a3057
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -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)
------------------
Expand Down
12 changes: 6 additions & 6 deletions UI/Templates/MailerUI/UIxMailFolderSubscriptions.wox
Expand Up @@ -28,21 +28,21 @@
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>
<p class="sg-item-name">
{{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>
Expand Down
2 changes: 1 addition & 1 deletion UI/WebServerResources/js/Mailer/Account.service.js
Expand Up @@ -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;

Expand Down
18 changes: 9 additions & 9 deletions UI/WebServerResources/js/Mailer/Mailbox.service.js
Expand Up @@ -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');
Expand Down Expand Up @@ -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');
};
})();
4 changes: 1 addition & 3 deletions UI/WebServerResources/js/Mailer/MailboxesController.js
Expand Up @@ -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();
}
Expand Down

0 comments on commit 62a3057

Please sign in to comment.