fix(calendar): check all changes before sending any

When one save changes several occurrences, each change is sent to the
attendees in turn. If a later change was refused, for example because a
resource was already booked, the earlier changes had already reached the
attendees while the organizer's calendar was left unchanged.

Run the booking and availability checks for all changes first, and send
nothing if one of them fails. A save with a single change skips this step,
because the normal check already covers it.
This commit is contained in:
Héctor Luaces authored and QHivert committed 2026-11-20 09:35:53 +01:00
1 parent 5c6a8fc8ee
commit 0f937186ae
2 files changed
+50

No files matched your search

@@ -2247,6 +2247,20 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
}
}
// Attendees are written to as each component is scheduled. Refuse the
// request before any of that happens if one component would be refused.
if ([removedEvents count] + [updatedEvents count] > 1)
{
for (i = 0; i < [updatedEvents count]; i++)
{
newEvent = [updatedEvents objectAtIndex: i];
if ((ex = [self _handleAttendeesConflicts: [newEvent attendees] forEvent: newEvent force: YES]))
return ex;
if ((ex = [self _handleAttendeesAvailability: [newEvent attendees] forEvent: newEvent]))
return ex;
}
}
for (i = 0; i < [removedEvents count]; i++)
[self prepareDeleteOccurence: [removedEvents objectAtIndex: i]];