From e24ee771e2d0048feb02ec143190fbc7a2bac574 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 14 Jun 2016 10:31:45 -0400 Subject: [PATCH] Honor the domain defaults when creating an event Initialize the editor with the value of SOGoAppointmentSendEMailNotifications from the domain defaults. Fixes #3729 --- NEWS | 1 + UI/PreferencesUI/UIxJSONPreferences.m | 14 +++++++++----- .../js/Scheduler/Component.service.js | 19 ++++++++++--------- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/NEWS b/NEWS index 1e5bcb04a..b8c2003d7 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,7 @@ Bug fixes - [web] sgTimePicker parser now respects the user's time format and language - [web] fixed time format when user chooses the default one - [web] added missing delegators identities in mail editor (#3720) + - [web] honor the domain default SOGoAppointmentSendEMailNotifications (#3729) - [core] properly handle sorted/deleted calendars (#3723) - [core] properly handle flattened timezone definitions (#2690) diff --git a/UI/PreferencesUI/UIxJSONPreferences.m b/UI/PreferencesUI/UIxJSONPreferences.m index 3548ea587..738977f4e 100644 --- a/UI/PreferencesUI/UIxJSONPreferences.m +++ b/UI/PreferencesUI/UIxJSONPreferences.m @@ -311,6 +311,14 @@ static SoProduct *preferencesProduct = nil; values = [[[[defaults source] values] mutableCopy] autorelease]; + // + // Expose additional information that must not be synchronized in the defaults + // + + // Expose the SOGoAppointmentSendEMailNotifications configuration parameter from the domain defaults + [values setObject: [NSNumber numberWithBool: [domainDefaults appointmentSendEMailNotifications]] + forKey: @"SOGoAppointmentSendEMailNotifications"]; + // Add locale code (used by CK Editor) locale = [[preferencesProduct resourceManager] localeForLanguageNamed: [defaults language]]; [values setObject: [locale objectForKey: @"NSLocaleCode"] forKey: @"LocaleCode"]; @@ -321,10 +329,7 @@ static SoProduct *preferencesProduct = nil; [locale objectForKey: @"NSShortWeekDayNameArray"], @"shortDays", nil] forKey: @"locale"]; - // - // We inject our default mail account, something we don't want to do before we - // call -synchronize on our defaults. - // + // We inject our default mail account accounts = [NSMutableArray arrayWithArray: [values objectForKey: @"AuxiliaryMailAccounts"]]; account = [[[context activeUser] mailAccounts] objectAtIndex: 0]; if (![account objectForKey: @"receipts"]) @@ -335,7 +340,6 @@ static SoProduct *preferencesProduct = nil; @"ignore", @"receiptAnyAction", nil] forKey: @"receipts"]; } - [accounts insertObject: account atIndex: 0]; [values setObject: accounts forKey: @"AuxiliaryMailAccounts"]; diff --git a/UI/WebServerResources/js/Scheduler/Component.service.js b/UI/WebServerResources/js/Scheduler/Component.service.js index 098fab782..fdda88e06 100644 --- a/UI/WebServerResources/js/Scheduler/Component.service.js +++ b/UI/WebServerResources/js/Scheduler/Component.service.js @@ -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 {