diff --git a/UI/Templates/PreferencesUI/UIxFilterEditor.wox b/UI/Templates/PreferencesUI/UIxFilterEditor.wox index 02e1ba772..c337ee129 100644 --- a/UI/Templates/PreferencesUI/UIxFilterEditor.wox +++ b/UI/Templates/PreferencesUI/UIxFilterEditor.wox @@ -131,7 +131,9 @@ - {{ item.name }} +
+ {{ item.name }} +
diff --git a/UI/WebServerResources/js/Mailer/Account.service.js b/UI/WebServerResources/js/Mailer/Account.service.js index 009324438..70e528c64 100644 --- a/UI/WebServerResources/js/Mailer/Account.service.js +++ b/UI/WebServerResources/js/Mailer/Account.service.js @@ -149,13 +149,13 @@ _visit = function(mailboxes) { _.each(mailboxes, function(o) { allMailboxes.push(o); - if (o.$expanded && o.children && o.children.length > 0) { + if ((options && options.all || o.$expanded) && o.children && o.children.length > 0) { _visit(o.children); } }); }; - if (this.$$flattenMailboxes && !(options && options.reload)) { + if (this.$$flattenMailboxes && !(options && (options.reload || options.all))) { allMailboxes = this.$$flattenMailboxes; } else { diff --git a/UI/WebServerResources/js/Preferences/FiltersDialogController.js b/UI/WebServerResources/js/Preferences/FiltersDialogController.js index 00761b56a..0bbe20118 100644 --- a/UI/WebServerResources/js/Preferences/FiltersDialogController.js +++ b/UI/WebServerResources/js/Preferences/FiltersDialogController.js @@ -7,9 +7,9 @@ /** * @ngInject */ - FiltersDialogController.$inject = ['$scope', '$mdDialog', 'filter', 'mailboxes', 'labels', 'sieveCapabilities']; - function FiltersDialogController($scope, $mdDialog, filter, mailboxes, labels, sieveCapabilities) { - var vm = this; + FiltersDialogController.$inject = ['$scope', '$window', '$mdDialog', 'filter', 'mailboxes', 'labels']; + function FiltersDialogController($scope, $window, $mdDialog, filter, mailboxes, labels) { + var vm = this, sieveCapabilities = $window.sieveCapabilities; vm.filter = filter; vm.mailboxes = mailboxes; diff --git a/UI/WebServerResources/js/Preferences/PreferencesController.js b/UI/WebServerResources/js/Preferences/PreferencesController.js index a72b7212c..7c83cda4a 100644 --- a/UI/WebServerResources/js/Preferences/PreferencesController.js +++ b/UI/WebServerResources/js/Preferences/PreferencesController.js @@ -7,9 +7,9 @@ /** * @ngInject */ - PreferencesController.$inject = ['$state', '$mdDialog', '$mdToast', 'Dialog', 'User', 'Mailbox', 'statePreferences', 'Authentication']; - function PreferencesController($state, $mdDialog, $mdToast, Dialog, User, Mailbox, statePreferences, Authentication) { - var vm = this; + PreferencesController.$inject = ['$state', '$mdDialog', '$mdToast', 'Dialog', 'User', 'Account', 'statePreferences', 'Authentication']; + function PreferencesController($state, $mdDialog, $mdToast, Dialog, User, Account, statePreferences, Authentication) { + var vm = this, account, mailboxes = []; vm.preferences = statePreferences; vm.passwords = { newPassword: null, newPasswordConfirmation: null }; @@ -35,7 +35,18 @@ vm.timeZonesList = window.timeZonesList; vm.timeZonesListFilter = timeZonesListFilter; vm.timeZonesSearchText = ''; - vm.mailboxes = Mailbox.$find({ id: 0 }); + + // Fetch a flatten version of the mailboxes list of the main account (0) + // This list will be forwarded to the Sieve filter controller + account = new Account({ id: 0 }); + account.$getMailboxes().then(function() { + var allMailboxes = account.$flattenMailboxes({all: true}), + index = -1, + length = allMailboxes.length; + while (++index < length) { + mailboxes.push(allMailboxes[index]); + } + }); function go(module) { $state.go('preferences.' + module); @@ -126,6 +137,7 @@ function addMailFilter(ev) { var filter = { match: 'all' }; + $mdDialog.show({ templateUrl: 'editFilter?filter=new', controller: 'FiltersDialogController', @@ -133,9 +145,8 @@ targetEvent: ev, locals: { filter: filter, - mailboxes: vm.mailboxes, - labels: vm.preferences.defaults.SOGoMailLabelsColors, - sieveCapabilities: window.sieveCapabilities + mailboxes: mailboxes, + labels: vm.preferences.defaults.SOGoMailLabelsColors } }).then(function() { if (!vm.preferences.defaults.SOGoSieveFilters) @@ -154,9 +165,8 @@ targetEvent: null, locals: { filter: filter, - mailboxes: vm.mailboxes, - labels: vm.preferences.defaults.SOGoMailLabelsColors, - sieveCapabilities: window.sieveCapabilities + mailboxes: mailboxes, + labels: vm.preferences.defaults.SOGoMailLabelsColors } }).then(function() { vm.preferences.defaults.SOGoSieveFilters[index] = filter;