(js) Fix handling of prevent invitations whitelist

This commit is contained in:
Francis Lachapelle
2015-12-07 11:05:01 -05:00
parent a4bc4fc652
commit ecf297208a
4 changed files with 40 additions and 28 deletions
@@ -52,11 +52,15 @@
this.settingsPromise = Preferences.$$resource.fetch("jsonSettings").then(function(data) {
// We convert our PreventInvitationsWhitelist hash into a array of user
if (data.Calendar && data.Calendar.PreventInvitationsWhitelist)
if (data.Calendar) {
if (data.Calendar.PreventInvitationsWhitelist)
data.Calendar.PreventInvitationsWhitelist = _.map(data.Calendar.PreventInvitationsWhitelist, function(value, key) {
var match = /^(.+)\s<(\S+)>$/.exec(value);
return new Preferences.$User({uid: key, cn: match[1], c_email: match[2]});
});
else
data.Calendar.PreventInvitationsWhitelist = [];
}
angular.extend(_this.settings, data);
@@ -49,6 +49,12 @@
}
});
// Set alternate avatar in User service
statePreferences.ready().then(function() {
if (statePreferences.defaults.SOGoAlternateAvatar)
User.$alternateAvatar = statePreferences.defaults.SOGoAlternateAvatar;
});
function go(module) {
$state.go('preferences.' + module);
}