Skip to content

Commit 177b13f

Browse files
authored
Merge pull request #45309 from nextcloud/fix/recurrence-exceptions-for-busy-events
fix(caldav): loop through all events for busy events
2 parents e3f341f + de49514 commit 177b13f

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

apps/dav/lib/CalDAV/CalendarObject.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,16 @@ protected function isShared() {
9797
* @param Component\VCalendar $vObject
9898
* @return void
9999
*/
100-
private function createConfidentialObject(Component\VCalendar $vObject) {
100+
private function createConfidentialObject(Component\VCalendar $vObject): void {
101101
/** @var Component $vElement */
102-
$vElement = null;
103-
if (isset($vObject->VEVENT)) {
104-
$vElement = $vObject->VEVENT;
105-
}
106-
if (isset($vObject->VJOURNAL)) {
107-
$vElement = $vObject->VJOURNAL;
108-
}
109-
if (isset($vObject->VTODO)) {
110-
$vElement = $vObject->VTODO;
111-
}
112-
if (!is_null($vElement)) {
102+
$vElements = array_filter($vObject->getComponents(), static function ($vElement) {
103+
return $vElement instanceof Component\VEvent || $vElement instanceof Component\VJournal || $vElement instanceof Component\VTodo;
104+
});
105+
106+
foreach ($vElements as $vElement) {
107+
if (empty($vElement->select('SUMMARY'))) {
108+
$vElement->add('SUMMARY', $this->l10n->t('Busy')); // This is needed to mask "Untitled Event" events
109+
}
113110
foreach ($vElement->children() as &$property) {
114111
/** @var Property $property */
115112
switch ($property->name) {

0 commit comments

Comments
 (0)