From 56f9e3e398f3baae31674e52d3a51da1dd3a0fd1 Mon Sep 17 00:00:00 2001
From: Francis Lachapelle
Date: Wed, 25 Aug 2021 16:53:40 -0400
Subject: [PATCH] fix(mail(js)): allow to add any event invitation
---
UI/MailPartViewers/UIxMailPartICalActions.m | 8 ++++++++
.../MailPartViewers/UIxMailPartICalViewer.wox | 19 ++++++++++++++-----
.../js/Scheduler/Component.service.js | 11 ++++++++---
3 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/UI/MailPartViewers/UIxMailPartICalActions.m b/UI/MailPartViewers/UIxMailPartICalActions.m
index 15596ecb1..661f44ffe 100644
--- a/UI/MailPartViewers/UIxMailPartICalActions.m
+++ b/UI/MailPartViewers/UIxMailPartICalActions.m
@@ -35,6 +35,7 @@
#import
#import
+#import
#import
#import
#import
@@ -331,6 +332,7 @@
{
iCalEvent *emailEvent;
SOGoAppointmentObject *eventObject;
+ SOGoUser *user;
WOResponse *response;
emailEvent = [self _emailEvent];
@@ -339,6 +341,12 @@
eventObject = [self _eventObjectWithUID: [emailEvent uid]];
if ([eventObject isNew])
{
+ user = [context activeUser];
+ if (![emailEvent userIsOrganizer: user] && ![emailEvent userIsAttendee: user])
+ {
+ [emailEvent setOrganizer: nil];
+ [emailEvent removeAllAttendees];
+ }
[eventObject saveCalendar: [emailEvent parent]];
response = [self responseWith204];
}
diff --git a/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox b/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox
index 54a66dae9..dfb456b8e 100644
--- a/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox
+++ b/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox
@@ -151,6 +151,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -182,8 +192,7 @@
+ being removed or the event being deleted -->
@@ -255,15 +264,15 @@
-
- person
+ person
{{$chip.name}}
-
+
diff --git a/UI/WebServerResources/js/Scheduler/Component.service.js b/UI/WebServerResources/js/Scheduler/Component.service.js
index 5177058c5..5b573078a 100644
--- a/UI/WebServerResources/js/Scheduler/Component.service.js
+++ b/UI/WebServerResources/js/Scheduler/Component.service.js
@@ -599,9 +599,9 @@
this.repeat.end = 'never';
this.$hasCustomRepeat = this.hasCustomRepeat();
+ var type = (this.type == 'appointment')? 'Events' : 'Tasks';
if (this.isNew) {
// Set default values
- var type = (this.type == 'appointment')? 'Events' : 'Tasks';
// Set default classification
this.classification = Component.$Preferences.defaults['SOGoCalendar' + type + 'DefaultClassification'].toLowerCase();
@@ -618,8 +618,13 @@
// Set notitifications
this.sendAppointmentNotifications = Component.$Preferences.defaults.SOGoAppointmentSendEMailNotifications;
}
- else if (angular.isUndefined(data.$hasAlarm)) {
- this.$hasAlarm = angular.isDefined(data.alarm);
+ else {
+ if (angular.isUndefined(data.$hasAlarm)) {
+ this.$hasAlarm = angular.isDefined(data.alarm);
+ }
+ if (angular.isUndefined(data.classification)) {
+ this.classification = Component.$Preferences.defaults['SOGoCalendar' + type + 'DefaultClassification'].toLowerCase();
+ }
}
// Allow the component to be moved to a different calendar