]> source.dussan.org Git - nextcloud-server.git/commitdiff
feat: Allow shared calendars as appointment conflict calendars
authorSebastianKrupinski <krupinskis05@gmail.com>
Tue, 8 Oct 2024 21:17:32 +0000 (17:17 -0400)
committerSebastianKrupinski <krupinskis05@gmail.com>
Tue, 29 Oct 2024 01:12:06 +0000 (21:12 -0400)
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
apps/dav/lib/CalDAV/CalendarProvider.php

index 207713de750d84e178d31d0ba8a39a6082fad787..a31322b2b49e77d29c5e12731fe85aeea0a75252 100644 (file)
@@ -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) {