diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2024-05-16 11:52:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-16 11:52:56 +0200 |
commit | 63da6067b4318f3d3bcc80f5f7ab574fe55ebd11 (patch) | |
tree | ce99aab8695719b9a9ff13d2762016f16b89b736 | |
parent | 97621842087c3bf65460c4701b74a55d8c6f8326 (diff) | |
parent | 5e0ce350120f7a759b61badd8670bf3ee8394a28 (diff) | |
download | nextcloud-server-63da6067b4318f3d3bcc80f5f7ab574fe55ebd11.tar.gz nextcloud-server-63da6067b4318f3d3bcc80f5f7ab574fe55ebd11.zip |
Merge pull request #45311 from nextcloud/backport/45309/stable27
[stable27] fix(caldav): loop through all events for busy events
-rw-r--r-- | apps/dav/lib/CalDAV/CalendarObject.php | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/apps/dav/lib/CalDAV/CalendarObject.php b/apps/dav/lib/CalDAV/CalendarObject.php index b9c7f3086d5..4294e543c17 100644 --- a/apps/dav/lib/CalDAV/CalendarObject.php +++ b/apps/dav/lib/CalDAV/CalendarObject.php @@ -97,19 +97,16 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject { * @param Component\VCalendar $vObject * @return void */ - private function createConfidentialObject(Component\VCalendar $vObject) { + private function createConfidentialObject(Component\VCalendar $vObject): void { /** @var Component $vElement */ - $vElement = null; - if (isset($vObject->VEVENT)) { - $vElement = $vObject->VEVENT; - } - if (isset($vObject->VJOURNAL)) { - $vElement = $vObject->VJOURNAL; - } - if (isset($vObject->VTODO)) { - $vElement = $vObject->VTODO; - } - if (!is_null($vElement)) { + $vElements = array_filter($vObject->getComponents(), static function ($vElement) { + return $vElement instanceof Component\VEvent || $vElement instanceof Component\VJournal || $vElement instanceof Component\VTodo; + }); + + foreach ($vElements as $vElement) { + if (empty($vElement->select('SUMMARY'))) { + $vElement->add('SUMMARY', $this->l10n->t('Busy')); // This is needed to mask "Untitled Event" events + } foreach ($vElement->children() as &$property) { /** @var Property $property */ switch ($property->name) { |