From 165041746e603683ff0bd11250dff0af950b584b Mon Sep 17 00:00:00 2001 From: SebastianKrupinski Date: Tue, 8 Oct 2024 17:17:32 -0400 Subject: [PATCH] feat: Allow shared calendars as appointment conflict calendars Signed-off-by: SebastianKrupinski --- apps/dav/lib/CalDAV/CalendarProvider.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/apps/dav/lib/CalDAV/CalendarProvider.php b/apps/dav/lib/CalDAV/CalendarProvider.php index 207713de750..a31322b2b49 100644 --- a/apps/dav/lib/CalDAV/CalendarProvider.php +++ b/apps/dav/lib/CalDAV/CalendarProvider.php @@ -24,16 +24,14 @@ class CalendarProvider implements ICalendarProvider { } public function getCalendars(string $principalUri, array $calendarUris = []): array { - $calendarInfos = []; - if (empty($calendarUris)) { - $calendarInfos = $this->calDavBackend->getCalendarsForUser($principalUri); - } else { - foreach ($calendarUris as $calendarUri) { - $calendarInfos[] = $this->calDavBackend->getCalendarByUri($principalUri, $calendarUri); - } - } - $calendarInfos = array_filter($calendarInfos); + $calendarInfos = $this->calDavBackend->getCalendarsForUser($principalUri) ?? []; + + if (!empty($calendarUris)) { + $calendarInfos = array_filter($calendarInfos, function ($calendar) use ($calendarUris) { + return in_array($calendar['uri'], $calendarUris); + }); + } $iCalendars = []; foreach ($calendarInfos as $calendarInfo) { -- 2.39.5