mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-11-20 14:36:53 +00:00
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:
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]];
|
||||
|
||||
|
||||
@@ -669,6 +669,42 @@ describe('CalDAV Scheduling', function() {
|
||||
.toBe('20261015T110000Z')
|
||||
})
|
||||
|
||||
it('refuses the whole PUT when one changed occurrence is refused', async function() {
|
||||
const uid = 'rrule-several-occurrences-refused'
|
||||
const icsName = `${uid}.ics`
|
||||
const blockerIcsName = `${uid}-blocker.ics`
|
||||
icsList.push(icsName, blockerIcsName)
|
||||
|
||||
await _deleteAllEvents(webdav_su, resourceNoOverbookCalendar)
|
||||
|
||||
// 1. Book the resource where the occurrence of the 8th will be moved
|
||||
await _putEvent(webdav, userCalendar, blockerIcsName, _calendar([
|
||||
'BEGIN:VEVENT',
|
||||
`UID:${uid}-blocker`,
|
||||
'DTSTAMP:20260901T100000Z',
|
||||
'DTSTART:20261008T110000Z',
|
||||
'DTEND:20261008T120000Z',
|
||||
'SUMMARY:Blocker',
|
||||
`ORGANIZER:${user.email}`,
|
||||
`ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION:${resourceNoOverbook.email}`,
|
||||
'END:VEVENT'
|
||||
]))
|
||||
|
||||
await _putEvent(webdav, userCalendar, icsName, _calendar(
|
||||
_master(uid, 'Weekly sync'), _exception(uid, '22', 'NEEDS-ACTION')))
|
||||
|
||||
// 2. Move the 15th, and the 8th with the booked resource
|
||||
const refused = _exception(uid, '08', 'NEEDS-ACTION')
|
||||
refused.splice(-1, 0, `ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION:${resourceNoOverbook.email}`)
|
||||
await _putEvent(webdav, userCalendar, icsName, _calendar(
|
||||
_master(uid, 'Weekly sync'), _exception(uid, '15', 'NEEDS-ACTION'), refused,
|
||||
_exception(uid, '22', 'NEEDS-ACTION')), 409)
|
||||
|
||||
expect(await _attendeeStartOf(icsName, '15'))
|
||||
.withContext('Occurrence of the 15th not moved in the calendar of the attendee')
|
||||
.toBeUndefined()
|
||||
})
|
||||
|
||||
it('schedules the master event along with a changed occurrence', async function() {
|
||||
const uid = 'rrule-master-and-occurrence'
|
||||
const icsName = `${uid}.ics`
|
||||
|
||||
Reference in new issue
Block a user