(fix) correctly calculate recurrence exceptions when not overlapping the recurrence id

This commit is contained in:
Ludovic Marcotte
2016-08-05 15:01:21 -04:00
parent 8ba6c6d9f5
commit 165d866cfc
2 changed files with 14 additions and 6 deletions
+1
View File
@@ -13,6 +13,7 @@ Bug fixes
- [web] really delete mailboxes being deleted from the Trash folder (#595, #1189, #641)
- [core] fixing sogo-tool backup with multi-domain configuration but domain-less logins
- [core] during event scheduling, use 409 instead of 403 so Lightning doesn't fail silently
- [core] correctly calculate recurrence exceptions when not overlapping the recurrence id
2.3.13 (2016-07-06)
-------------------
+13 -6
View File
@@ -979,12 +979,16 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
withTimeZone: (NSTimeZone *) tz
toArray: (NSMutableArray *) ma
{
NGCalendarDateRange *recurrenceIdRange;
NSCalendarDate *recurrenceId;
NSMutableDictionary *newRecord;
NGCalendarDateRange *newRecordRange;
NSComparisonResult compare;
int recordIndex, secondsOffsetFromGMT;
NSNumber *dateSecs;
id master;
int recordIndex, secondsOffsetFromGMT;
NSTimeInterval delta;
newRecord = nil;
recurrenceId = [component recurrenceId];
@@ -1006,17 +1010,20 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
[recurrenceId setTimeZone: tz];
}
compare = [[dateRange startDate] compare: recurrenceId];
if ((compare == NSOrderedAscending || compare == NSOrderedSame) &&
[[dateRange endDate] compare: recurrenceId] == NSOrderedDescending)
master = [[[component parent] events] objectAtIndex: 0];
delta = [[master endDate] timeIntervalSinceDate: [master startDate]];
recurrenceIdRange = [NGCalendarDateRange calendarDateRangeWithStartDate: recurrenceId
endDate: [recurrenceId dateByAddingYears:0 months:0 days:0 hours:0 minutes:0 seconds: delta]];
if ([dateRange doesIntersectWithDateRange: recurrenceIdRange])
{
// The recurrence exception intersects with the date range;
// find the occurence and replace it with the new record
recordIndex = [self _indexOfRecordMatchingDate: recurrenceId inArray: ma];
if (recordIndex > -1)
{
if ([dateRange containsDate: [component startDate]])
{
if ([dateRange containsDate: [component startDate]] ||
[dateRange containsDate: [component endDate]])
{
// We must pass nil to :container here in order to avoid re-entrancy issues.
newRecord = [self _fixupRecord: [component quickRecordFromContent: nil container: nil]];
[ma replaceObjectAtIndex: recordIndex withObject: newRecord];