diff options
author | Sebastian Krupinski <165827823+SebastianKrupinski@users.noreply.github.com> | 2024-11-04 13:52:15 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-04 13:52:15 -0500 |
commit | 9d49c75bdb86f3e1ded4dc6784f7de4e6830713e (patch) | |
tree | 779661acad56c488b056e8c19ffbae6945e8dd4a | |
parent | 5cd3a8c9ada5ea2951eb011b449ee483b9d5a322 (diff) | |
parent | 5f49effcba28043050e46e1ba6be7b40f4b6dcd4 (diff) | |
download | nextcloud-server-9d49c75bdb86f3e1ded4dc6784f7de4e6830713e.tar.gz nextcloud-server-9d49c75bdb86f3e1ded4dc6784f7de4e6830713e.zip |
Merge pull request #48621 from nextcloud/feat/issue-3786-allow-shared-calendars
feat: Allow shared calendars as appointment conflict calendars
-rw-r--r-- | apps/dav/lib/CalDAV/CalendarProvider.php | 16 |
1 files 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) { |