Skip to content

Commit

Permalink
fix(calendar): Fix duplicates in series appointments for Apple's Cale…
Browse files Browse the repository at this point in the history
…ndar
  • Loading branch information
WoodySlum committed Jul 11, 2023
1 parent a484407 commit 7600e9e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
8 changes: 6 additions & 2 deletions SOPE/NGCards/iCalEventChanges.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ - (void)_trackPropertyChanges:(iCalEvent *)_from :(iCalEvent *)_to {
if(!IS_EQUAL([_from created], [_to created], isEqualToDate:))
[updatedProperties addObject:@"created"];
if(!IS_EQUAL([_from lastModified], [_to lastModified], isEqualToDate:))
[updatedProperties addObject:@"lastModified"];
if(![_from durationAsTimeInterval] == [_to durationAsTimeInterval])
[updatedProperties addObject:@"timeStampAsDate"];
if(!IS_EQUAL([_from timeStampAsDate], [_to timeStampAsDate], isEqualToDate:))
[updatedProperties addObject:@"timeStampAsDate"];
if([_from durationAsTimeInterval] != [_to durationAsTimeInterval])
[updatedProperties addObject:@"duration"];
if(!IS_EQUAL([_from summary], [_to summary], isEqualToString:))
[updatedProperties addObject:@"summary"];
Expand All @@ -145,6 +147,8 @@ - (void)_trackPropertyChanges:(iCalEvent *)_from :(iCalEvent *)_to {
[updatedProperties addObject:@"organizer"];
if(!IS_EQUAL([_from recurrenceRules], [_to recurrenceRules], isEqual:))
[updatedProperties addObject:@"rrule"];
if(!IS_EQUAL([_from recurrenceId], [_to recurrenceId], isEqualToDate:))
[updatedProperties addObject:@"rid"];
if(!IS_EQUAL([_from exceptionRules], [_to exceptionRules], isEqual:))
[updatedProperties addObject:@"exrule"];
if(!IS_EQUAL([_from exceptionDates], [_to exceptionDates], isEqual:))
Expand Down
7 changes: 5 additions & 2 deletions SoObjects/Appointments/SOGoAppointmentObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,13 @@ - (void) _addOrUpdateEvent: (iCalEvent *) newEvent
iCalCalendar *iCalendarToSave;
iCalPerson *attendee;
SOGoUser *user;
WORequest *rq;

iCalendarToSave = nil;
user = [SOGoUser userWithLogin: theUID];
attendeeObject = [self _lookupEvent: [newEvent uid] forUID: theUID];
attendee = [newEvent userAsAttendee: user];
rq = [context request];

// If the atttende's role is NON-PARTICIPANT, we write nothing to its calendar
if ([[attendee role] caseInsensitiveCompare: @"NON-PARTICIPANT"] == NSOrderedSame)
Expand All @@ -217,8 +219,9 @@ - (void) _addOrUpdateEvent: (iCalEvent *) newEvent

return;
}

if ([newEvent recurrenceId])


if ([newEvent recurrenceId] && ![rq isICal4] && ![rq isICal])
{
// We must add an occurence to a non-existing event.
if ([attendeeObject isNew])
Expand Down
2 changes: 1 addition & 1 deletion SoObjects/Appointments/iCalEventChanges+SOGo.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ - (BOOL) sequenceShouldBeIncreased
static NSString *properties[] = {@"organizer", @"startDate", @"endDate",
@"due", @"duration", @"summary",
@"rdate", @"rrule", @"exdate", @"exrule",
@"status", @"location",
@"status", @"location", @"rid", @"timeStampAsDate",
nil};
NSString **currentProperty;
BOOL updateRequired;
Expand Down

0 comments on commit 7600e9e

Please sign in to comment.