Honor the domain defaults when creating an event

Initialize the editor with the value of
SOGoAppointmentSendEMailNotifications from the domain defaults.

Fixes #3729
This commit is contained in:
Francis Lachapelle
2016-06-14 10:31:45 -04:00
parent ff65ba88ad
commit e24ee771e2
3 changed files with 20 additions and 14 deletions
@@ -475,14 +475,6 @@
this.delta = 60;
angular.extend(this, data);
Component.$Preferences.ready().then(function() {
var type = (_this.type == 'appointment')? 'Events' : 'Tasks';
// Set default values from user's defaults
_this.classification = _this.classification ||
Component.$Preferences.defaults['SOGoCalendar' + type + 'DefaultClassification'].toLowerCase();
});
if (this.component == 'vevent')
this.type = 'appointment';
else if (this.component == 'vtodo')
@@ -564,8 +556,14 @@
this.$hasCustomRepeat = this.hasCustomRepeat();
if (this.isNew) {
// Set default alarm
// Set default values
Component.$Preferences.ready().then(function() {
var type = (_this.type == 'appointment')? 'Events' : 'Tasks';
// Set default classification
_this.classification = Component.$Preferences.defaults['SOGoCalendar' + type + 'DefaultClassification'].toLowerCase();
// Set default alarm
var units = { M: 'MINUTES', H: 'HOURS', D: 'DAYS', W: 'WEEKS' };
var match = /-PT?([0-9]+)([MHDW])/.exec(Component.$Preferences.defaults.SOGoCalendarDefaultReminder);
if (match) {
@@ -573,6 +571,9 @@
_this.alarm.quantity = parseInt(match[1]);
_this.alarm.unit = units[match[2]];
}
// Set notitifications
_this.sendAppointmentNotifications = Component.$Preferences.defaults.SOGoAppointmentSendEMailNotifications;
});
}
else {