From 2637434436c19157ce6255fb071dcb99cf57ad89 Mon Sep 17 00:00:00 2001 From: smizrahi Date: Wed, 12 Jun 2024 12:00:41 +0200 Subject: [PATCH] feat(calendar): Add option to disable email appointmoint notifications when using caldav --- SoObjects/Appointments/SOGoCalendarComponent.m | 12 +++++++++++- UI/PreferencesUI/English.lproj/Localizable.strings | 1 + UI/PreferencesUI/French.lproj/Localizable.strings | 1 + UI/Templates/PreferencesUI/UIxPreferences.wox | 6 ++++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/SoObjects/Appointments/SOGoCalendarComponent.m b/SoObjects/Appointments/SOGoCalendarComponent.m index 7355af7cc..481e8ce21 100644 --- a/SoObjects/Appointments/SOGoCalendarComponent.m +++ b/SoObjects/Appointments/SOGoCalendarComponent.m @@ -806,6 +806,7 @@ ownerUser = [SOGoUser userWithLogin: owner]; dd = [ownerUser domainDefaults]; + if ([dd appointmentSendEMailNotifications] && [object isStillRelevant]) { count = [attendees count]; @@ -1033,6 +1034,8 @@ to: (iCalPerson *) recipient { SOGoDomainDefaults *dd; + SOGoUserSettings *settings; + BOOL canSendNotification, doNotSendNotificationOnCalDav; // We never send IMIP reply when the "initiator" is Outlook 2013/2016 over // the EAS protocol. That is because Outlook will always issue a SendMail command @@ -1042,8 +1045,15 @@ if ([[context objectForKey: @"DeviceType"] isEqualToString: @"WindowsOutlook15"]) return; + canSendNotification = NO; + settings = [from userSettings]; + doNotSendNotificationOnCalDav = ([settings objectForKey: @"Calendar"] + && [[settings objectForKey: @"Calendar"] objectForKey: @"InvitationNotificationsOnCalDavDisabled"] + && 1 == [[[settings objectForKey: @"Calendar"] objectForKey: @"InvitationNotificationsOnCalDavDisabled"] intValue]); + canSendNotification = !doNotSendNotificationOnCalDav || !(doNotSendNotificationOnCalDav && [[context request] isSoWebDAVRequest]); + dd = [from domainDefaults]; - if ([dd appointmentSendEMailNotifications] && [event isStillRelevant]) + if ([dd appointmentSendEMailNotifications] && [event isStillRelevant] && canSendNotification) { // We first send to the real recipient (organizer) [self _sendIMIPReplyForEvent: event diff --git a/UI/PreferencesUI/English.lproj/Localizable.strings b/UI/PreferencesUI/English.lproj/Localizable.strings index f21a8dd21..083cdcfa1 100644 --- a/UI/PreferencesUI/English.lproj/Localizable.strings +++ b/UI/PreferencesUI/English.lproj/Localizable.strings @@ -152,6 +152,7 @@ "Contacts Names" = "Contacts Names"; "Duplicate name" = "Duplicate name"; "Calendar categories must have unique names." = "Calendar categories must have unique names."; +"Disable e-mail notifications on CalDAV" = "Disable e-mail notifications on CalDAV"; /* Default Calendar */ "Default calendar" = "Default calendar"; diff --git a/UI/PreferencesUI/French.lproj/Localizable.strings b/UI/PreferencesUI/French.lproj/Localizable.strings index 8f372f500..cf24caafd 100644 --- a/UI/PreferencesUI/French.lproj/Localizable.strings +++ b/UI/PreferencesUI/French.lproj/Localizable.strings @@ -152,6 +152,7 @@ "Contacts Names" = "Noms des contacts"; "Duplicate name" = "Nom déjà utilisé"; "Calendar categories must have unique names." = "Les catégories doivent être uniques."; +"Disable e-mail notifications on CalDAV" = "Désactiver les notifications e-mail avec CalDAV"; /* Default Calendar */ "Default calendar" = "Calendrier par défaut"; diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox index 92b26f1d6..e26230dcd 100644 --- a/UI/Templates/PreferencesUI/UIxPreferences.wox +++ b/UI/Templates/PreferencesUI/UIxPreferences.wox @@ -552,6 +552,12 @@ id="calendarInvitationsTab-content">
+ + +