Expose user's settings and defaults inline

This improves performance by removing two AJAX calls and a lot of
JavaScript promises.
This commit is contained in:
Francis Lachapelle
2017-06-01 13:48:45 -04:00
parent 1fa056bb25
commit 89bfa0c536
22 changed files with 441 additions and 484 deletions
@@ -48,16 +48,15 @@
$$resource: new Resource(Settings.activeUser('folderURL') + 'Mail', Settings.activeUser()),
$avatar: angular.bind(Preferences, Preferences.avatar)
});
// Initialize tags form user's defaults
Preferences.ready().then(function() {
if (Preferences.defaults.SOGoMailLabelsColors) {
Message.$tags = Preferences.defaults.SOGoMailLabelsColors;
}
if (Preferences.defaults.SOGoMailDisplayRemoteInlineImages &&
Preferences.defaults.SOGoMailDisplayRemoteInlineImages == 'always') {
Message.$displayRemoteInlineImages = true;
}
});
if (Preferences.defaults.SOGoMailLabelsColors) {
Message.$tags = Preferences.defaults.SOGoMailLabelsColors;
}
if (Preferences.defaults.SOGoMailDisplayRemoteInlineImages &&
Preferences.defaults.SOGoMailDisplayRemoteInlineImages == 'always') {
Message.$displayRemoteInlineImages = true;
}
return Message; // return constructor
}];