mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-30 02:37:16 +00:00
(js) Fix syncing of calendar categories colors
This commit is contained in:
@@ -114,10 +114,13 @@
|
||||
angular.isArray(data.Forward.forwardAddress))
|
||||
data.Forward.forwardAddress = data.Forward.forwardAddress.join(",");
|
||||
|
||||
if (angular.isUndefined(data.SOGoCalendarCategoriesColors)) {
|
||||
data.SOGoCalendarCategoriesColors = {};
|
||||
// Split calendar categories colors keys and values
|
||||
if (angular.isUndefined(data.SOGoCalendarCategories))
|
||||
data.SOGoCalendarCategories = [];
|
||||
}
|
||||
data.SOGoCalendarCategoriesColorsValues = [];
|
||||
_.forEach(data.SOGoCalendarCategories, function (value) {
|
||||
data.SOGoCalendarCategoriesColorsValues.push(data.SOGoCalendarCategoriesColors[value]);
|
||||
});
|
||||
|
||||
if (angular.isUndefined(data.SOGoContactsCategories))
|
||||
data.SOGoContactsCategories = [];
|
||||
@@ -329,6 +332,13 @@
|
||||
if (preferences.defaults.Forward && preferences.defaults.Forward.forwardAddress)
|
||||
preferences.defaults.Forward.forwardAddress = preferences.defaults.Forward.forwardAddress.split(",");
|
||||
|
||||
// Merge back calendar categories colors keys and values
|
||||
preferences.defaults.SOGoCalendarCategoriesColors = {};
|
||||
_.forEach(preferences.defaults.SOGoCalendarCategories, function(key, i) {
|
||||
preferences.defaults.SOGoCalendarCategoriesColors[key] = preferences.defaults.SOGoCalendarCategoriesColorsValues[i];
|
||||
});
|
||||
delete preferences.defaults.SOGoCalendarCategoriesColorsValues;
|
||||
|
||||
if (preferences.settings.Calendar && preferences.settings.Calendar.PreventInvitationsWhitelist) {
|
||||
_.forEach(preferences.settings.Calendar.PreventInvitationsWhitelist, function(user) {
|
||||
whitelist[user.uid] = user.$shortFormat();
|
||||
|
||||
@@ -64,13 +64,13 @@
|
||||
|
||||
this.resetCalendarCategories = function(form) {
|
||||
this.preferences.defaults.SOGoCalendarCategories = _.keys($window.defaultCalendarCategories);
|
||||
this.preferences.defaults.SOGoCalendarCategoriesColors = angular.copy($window.defaultCalendarCategories);
|
||||
this.preferences.defaults.SOGoCalendarCategoriesColorsValues = _.values($window.defaultCalendarCategories);
|
||||
form.$setDirty();
|
||||
};
|
||||
|
||||
this.addCalendarCategory = function(form) {
|
||||
this.preferences.defaults.SOGoCalendarCategoriesColors[l('New category')] = "#aaa";
|
||||
this.preferences.defaults.SOGoCalendarCategories.push(l('New category'));
|
||||
this.preferences.defaults.SOGoCalendarCategoriesColorsValues.push("#aaa");
|
||||
focus('calendarCategory_' + (this.preferences.defaults.SOGoCalendarCategories.length - 1));
|
||||
form.$setDirty();
|
||||
};
|
||||
@@ -80,9 +80,8 @@
|
||||
};
|
||||
|
||||
this.removeCalendarCategory = function(index, form) {
|
||||
var key = this.preferences.defaults.SOGoCalendarCategories[index];
|
||||
this.preferences.defaults.SOGoCalendarCategories.splice(index, 1);
|
||||
delete this.preferences.defaults.SOGoCalendarCategoriesColors[key];
|
||||
this.preferences.defaults.SOGoCalendarCategoriesColorsValues.splice(index, 1);
|
||||
form.$setDirty();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user