Skip to content

Commit

Permalink
Merge pull request #48621 from nextcloud/feat/issue-3786-allow-shared…
Browse files Browse the repository at this point in the history
…-calendars

feat: Allow shared calendars as appointment conflict calendars
  • Loading branch information
SebastianKrupinski authored Nov 4, 2024
2 parents 5cd3a8c + 5f49eff commit 9d49c75
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions apps/dav/lib/CalDAV/CalendarProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ public function __construct(
}

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) {
Expand Down

0 comments on commit 9d49c75

Please sign in to comment.