Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -3505,7 +3505,19 @@ public function getDenormalizedData(string $calendarData): array {
// If there is exactly one base component of a supported type, extract its data directly.
$baseComponent = $vObject->getBaseComponent();
if ($baseComponent !== null && in_array($baseComponent->name, $supportedComponentTypes, true)) {
return $derived + $extract($baseComponent);
$data = $extract($baseComponent);
foreach ($vObject->getComponents() as $component) {
if ($component === $baseComponent || $component->name !== $baseComponent->name || !isset($component->{'RECURRENCE-ID'})) {
continue;
}
$exceptionData = $extract($component);
if ($exceptionData['firstOccurence'] > 0) {
$data['firstOccurence'] = min($data['firstOccurence'], $exceptionData['firstOccurence']);
}
$data['lastOccurence'] = max($data['lastOccurence'], $exceptionData['lastOccurence']);
}

return $derived + $data;
}

// No supported base component is present, e.g. a scheduling object made up solely of recurrence exceptions without an
Expand Down
4 changes: 4 additions & 0 deletions apps/dav/tests/unit/CalDAV/CalDavBackendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,10 @@ public static function providesCalDataForGetDenormalizedData(): array {
'multiple exceptions without master use earliest DTSTART as firstOccurence' => [(new DateTime('2024-03-01T09:00:00Z'))->getTimestamp(), 'firstOccurence', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//SabreDAV//SabreDAV//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nUID:multi-exception@example.com\r\nDTSTAMP:20240301T080000Z\r\nDTSTART:20240301T090000Z\r\nDTEND:20240301T150000Z\r\nRECURRENCE-ID:20240301T090000Z\r\nSUMMARY:Long occurrence\r\nEND:VEVENT\r\nBEGIN:VEVENT\r\nUID:multi-exception@example.com\r\nDTSTAMP:20240301T080000Z\r\nDTSTART:20240305T090000Z\r\nDTEND:20240305T093000Z\r\nRECURRENCE-ID:20240305T090000Z\r\nSUMMARY:Short later occurrence\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"],
'multiple exceptions without master use latest DTEND as lastOccurence regardless of which exception is earliest' => [(new DateTime('2024-03-05T09:30:00Z'))->getTimestamp(), 'lastOccurence', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//SabreDAV//SabreDAV//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nUID:multi-exception@example.com\r\nDTSTAMP:20240301T080000Z\r\nDTSTART:20240301T090000Z\r\nDTEND:20240301T150000Z\r\nRECURRENCE-ID:20240301T090000Z\r\nSUMMARY:Long occurrence\r\nEND:VEVENT\r\nBEGIN:VEVENT\r\nUID:multi-exception@example.com\r\nDTSTAMP:20240301T080000Z\r\nDTSTART:20240305T090000Z\r\nDTEND:20240305T093000Z\r\nRECURRENCE-ID:20240305T090000Z\r\nSUMMARY:Short later occurrence\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"],
'multiple exceptions without master resolve uid' => ['multi-exception@example.com', 'uid', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//SabreDAV//SabreDAV//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nUID:multi-exception@example.com\r\nDTSTAMP:20240301T080000Z\r\nDTSTART:20240301T090000Z\r\nDTEND:20240301T150000Z\r\nRECURRENCE-ID:20240301T090000Z\r\nSUMMARY:Long occurrence\r\nEND:VEVENT\r\nBEGIN:VEVENT\r\nUID:multi-exception@example.com\r\nDTSTAMP:20240301T080000Z\r\nDTSTART:20240305T090000Z\r\nDTEND:20240305T093000Z\r\nRECURRENCE-ID:20240305T090000Z\r\nSUMMARY:Short later occurrence\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"],

// Overridden instance moved outside the master's range
'exception moved after master extends lastOccurence' => [(new DateTime('2026-10-28T11:20:00Z'))->getTimestamp(), 'lastOccurence', CAL],
'exception moved before master extends firstOccurence' => [(new DateTime('2026-10-06T10:00:00Z'))->getTimestamp(), 'firstOccurence', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//test//EN\r\nBEGIN:VEVENT\r\nUID:moved-1\r\nDTSTAMP:20261025T000000Z\r\nDTSTART:20261013T100000Z\r\nRDATE:20261013T100000Z\r\nEND:VEVENT\r\nBEGIN:VEVENT\r\nUID:moved-1\r\nDTSTAMP:20261025T000000Z\r\nRECURRENCE-ID:20261013T100000Z\r\nDTSTART:20261006T100000Z\r\nDTEND:20261006T112000Z\r\nSUMMARY:Moved meeting\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"],
];
}

Expand Down
Loading