From aaf4166c44f67eb446810509e3b589b8392fdf55 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Thu, 7 Feb 2019 14:10:39 -0500 Subject: [PATCH] (fix) handle role change during event updates --- .../Appointments/SOGoAppointmentObject.m | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index c02556d24..4b7fee5c7 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -197,7 +197,24 @@ // If the atttende's role is NON-PARTICIPANT, we write nothing to its calendar if ([[attendee role] caseInsensitiveCompare: @"NON-PARTICIPANT"] == NSOrderedSame) - return; + { + // If the attendee's previous role was not NON-PARTICIPANT we must also delete + // the event from its calendar + attendee = [oldEvent userAsAttendee: user]; + if ([[attendee role] caseInsensitiveCompare: @"NON-PARTICIPANT"] != NSOrderedSame) + { + NSString *currentUID; + + currentUID = [attendee uidInContext: context]; + if (currentUID) + [self _removeEventFromUID: currentUID + owner: owner + withRecurrenceId: [oldEvent recurrenceId]]; + + } + + return; + } if ([newEvent recurrenceId]) { @@ -1180,7 +1197,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent // If the atttende's role is NON-PARTICIPANT, we write nothing to its calendar if ([[attendee role] caseInsensitiveCompare: @"NON-PARTICIPANT"] == NSOrderedSame) - return; + return nil; error = nil;