Fix saving of inactive calendars

Fixes #3862, #3980
This commit is contained in:
Francis Lachapelle
2017-01-06 06:42:12 -05:00
parent 02fc147624
commit ea7934a73c
5 changed files with 78 additions and 10 deletions
@@ -94,7 +94,6 @@
list = this.$calendars;
sibling = _.findIndex(list, function(o, i) {
console.debug(i + ': "' + o.id + '".localeCompare("' + calendar.name + '") = ' + o.name.localeCompare(calendar.name));
return (calendar.id == 'personal' ||
(o.id != 'personal' && o.name.localeCompare(calendar.name) > 0));
});
@@ -325,6 +324,24 @@
return Calendar.$q.all(promises);
};
/**
* @function saveFoldersActivation
* @memberof Calendar
* @desc Save to the user's settings the activation state of the calendars
* @param {string[]} folders - the folders IDs
* @returns a promise of the HTTP operation
*/
Calendar.saveFoldersActivation = function(ids) {
var request = {};
_.forEach(ids, function(id) {
var calendar = Calendar.$get(id);
request[calendar.id] = calendar.active;
});
return Calendar.$$resource.post(null, 'saveFoldersActivation', request);
};
/**
* @function saveFoldersOrder
* @desc Save to the user's settings the current calendars order.