From dff30d61fb286fb2dc714559ffe7fb5df45af558 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Thu, 31 Aug 2017 14:40:54 -0400 Subject: [PATCH] (fix) Update the proper occurrence When editing one occurrence of a recurrent event with attendees, update the proper occurrence in each attendee's calendar. --- .../Appointments/SOGoAppointmentObject.m | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index ef55f1465..985218ec3 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -225,23 +225,27 @@ // If recurrenceId is defined, remove the occurence from // the repeating event. If a recurrenceId is defined in the // new event, let's make sure we don't already have one in - // the calendar alright. If so, also remove it. + // the calendar already. If so, also remove it. if ([oldEvent recurrenceId] || [newEvent recurrenceId]) { // FIXME: use _eventFromRecurrenceId:... occurences = [iCalendarToSave events]; - max = [occurences count]; - count = 0; - while (count < max) + currentId = ([oldEvent recurrenceId] ? [oldEvent recurrenceId]: [newEvent recurrenceId]); + if (currentId) { - occurence = [occurences objectAtIndex: count]; - currentId = ([oldEvent recurrenceId] ? [oldEvent recurrenceId]: [newEvent recurrenceId]); - if (currentId && [[occurence recurrenceId] compare: currentId] == NSOrderedSame) + max = [occurences count]; + count = 0; + while (count < max) { - [[iCalendarToSave children] removeObject: occurence]; - break; + occurence = [occurences objectAtIndex: count]; + if ([occurence recurrenceId] && + [[occurence recurrenceId] compare: currentId] == NSOrderedSame) + { + [iCalendarToSave removeChild: occurence]; + break; + } + count++; } - count++; } }