From 9a9d968756e1e344c3433790b48d0fdfbe2f8e3b Mon Sep 17 00:00:00 2001 From: smizrahi Date: Wed, 6 Nov 2024 18:14:15 +0100 Subject: [PATCH] Revert "fix(calendar): Fix issue where EXDATE removes modified occurence. The behavior is now identical to G Agenda. This fix may reduce the 'missing exception error'." This reverts commit 5bab72726aa8b08baaa189310ede27cf9747be5e. --- .../Appointments/SOGoAppointmentFolder.m | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 5cb6f3281..3d1b61147 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -1130,26 +1130,28 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir delta = [masterEndDate timeIntervalSinceDate: [master startDate]]; recurrenceIdRange = [NGCalendarDateRange calendarDateRangeWithStartDate: recurrenceId endDate: [recurrenceId dateByAddingYears:0 months:0 days:0 hours:0 minutes:0 seconds: delta]]; - recordIndex = [self _indexOfRecordMatchingDate: recurrenceId inArray: ma]; - if ([dateRange doesIntersectWithDateRange: recurrenceIdRange] && recordIndex == -1) { - [self warnWithFormat: - @"missing exception record for recurrence-id %@ (uid %@), ma = %@, dr = %@, rir = %@", - recurrenceId, [component uid], ma, dateRange, recurrenceIdRange]; - } - if ([dateRange doesIntersectWithDateRange: recurrenceIdRange] && recordIndex != -1) + if ([dateRange doesIntersectWithDateRange: recurrenceIdRange]) { // The recurrence exception intersects with the date range; // find the occurence and replace it with the new record - if ([dateRange containsDate: [component startDate]] || - (endDate && [dateRange containsDate: endDate])) - { - // We must pass nil to :container here in order to avoid re-entrancy issues. - newRecord = [self _fixupRecord: [component quickRecordFromContent: nil container: nil nameInContainer: nil]]; - [ma replaceObjectAtIndex: recordIndex withObject: newRecord]; - } - else - // The range doesn't cover the exception; remove it from the records - [ma removeObjectAtIndex: recordIndex]; + recordIndex = [self _indexOfRecordMatchingDate: recurrenceId inArray: ma]; + if (recordIndex > -1) + { + if ([dateRange containsDate: [component startDate]] || + (endDate && [dateRange containsDate: endDate])) + { + // We must pass nil to :container here in order to avoid re-entrancy issues. + newRecord = [self _fixupRecord: [component quickRecordFromContent: nil container: nil nameInContainer: nil]]; + [ma replaceObjectAtIndex: recordIndex withObject: newRecord]; + } + else + // The range doesn't cover the exception; remove it from the records + [ma removeObjectAtIndex: recordIndex]; + } + else + [self errorWithFormat: + @"missing exception record for recurrence-id %@ (uid %@)", + recurrenceId, [component uid]]; } else {