mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-14 01:38:51 +00:00
(i18n) Localized mailboxes names in filter editor
Delayed mailboxes initialization to make sure the MailerUI labels are loaded. Fixes #4584
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
PreferencesController.$inject = ['$q', '$window', '$state', '$mdMedia', '$mdSidenav', '$mdDialog', '$mdToast', 'sgSettings', 'sgFocus', 'Dialog', 'User', 'Account', 'Preferences', 'Authentication'];
|
||||
function PreferencesController($q, $window, $state, $mdMedia, $mdSidenav, $mdDialog, $mdToast, sgSettings, focus, Dialog, User, Account, Preferences, Authentication) {
|
||||
var vm = this, account, mailboxes = [], today = new Date().beginOfDay();
|
||||
var vm = this, mailboxes = [], today = new Date().beginOfDay();
|
||||
|
||||
this.$onInit = function() {
|
||||
this.preferences = Preferences;
|
||||
@@ -19,21 +19,6 @@
|
||||
this.sieveVariablesCapability = ($window.sieveCapabilities.indexOf('variables') >= 0);
|
||||
this.mailLabelKeyRE = new RegExp(/^(?!^_\$)[^(){} %*\"\\\\]*?$/);
|
||||
|
||||
|
||||
if (sgSettings.activeUser('path').mail) {
|
||||
// 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]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Set alternate avatar in User service
|
||||
if (Preferences.defaults.SOGoAlternateAvatar)
|
||||
User.$alternateAvatar = Preferences.defaults.SOGoAlternateAvatar;
|
||||
@@ -187,9 +172,31 @@
|
||||
form.$setDirty();
|
||||
};
|
||||
|
||||
function _loadAllMailboxes() {
|
||||
var account;
|
||||
|
||||
if (mailboxes.length) {
|
||||
return;
|
||||
}
|
||||
if (sgSettings.activeUser('path').mail) {
|
||||
// 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]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.addMailFilter = function(ev, form) {
|
||||
var filter = { match: 'all', active: 1 };
|
||||
|
||||
_loadAllMailboxes();
|
||||
$mdDialog.show({
|
||||
templateUrl: 'editFilter?filter=new',
|
||||
controller: 'FiltersDialogController',
|
||||
@@ -211,6 +218,7 @@
|
||||
this.editMailFilter = function(ev, index, form) {
|
||||
var filter = angular.copy(this.preferences.defaults.SOGoSieveFilters[index]);
|
||||
|
||||
_loadAllMailboxes();
|
||||
$mdDialog.show({
|
||||
templateUrl: 'editFilter?filter=' + index,
|
||||
controller: 'FiltersDialogController',
|
||||
|
||||
Reference in New Issue
Block a user