Skip to content

Commit

Permalink
(fix) handle role change during event updates
Browse files Browse the repository at this point in the history
  • Loading branch information
extrafu committed Feb 7, 2019
1 parent c5d31a9 commit aaf4166
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions SoObjects/Appointments/SOGoAppointmentObject.m
Expand Up @@ -197,7 +197,24 @@ - (void) _addOrUpdateEvent: (iCalEvent *) newEvent

// 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])
{
Expand Down Expand Up @@ -1180,7 +1197,7 @@ - (NSException *) _updateAttendee: (iCalPerson *) attendee

// 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;

Expand Down

0 comments on commit aaf4166

Please sign in to comment.