From 0b96b169025b222c532101aad26099f8a2a771a8 Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Thu, 17 Jul 2025 14:19:29 +0200 Subject: [PATCH] fix(caldav): don't return cancelled events for upcoming events API Signed-off-by: Anna Larch --- apps/dav/lib/CalDAV/UpcomingEventsService.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/dav/lib/CalDAV/UpcomingEventsService.php b/apps/dav/lib/CalDAV/UpcomingEventsService.php index 6614d937ff717..1a8aed5bd711a 100644 --- a/apps/dav/lib/CalDAV/UpcomingEventsService.php +++ b/apps/dav/lib/CalDAV/UpcomingEventsService.php @@ -47,7 +47,7 @@ public function getEvents(string $userId, ?string $location = null): array { $this->userManager->get($userId), ); - return array_map(function (array $event) use ($userId, $calendarAppEnabled) { + return array_filter(array_map(function (array $event) use ($userId, $calendarAppEnabled) { $calendarAppUrl = null; if ($calendarAppEnabled) { @@ -67,6 +67,10 @@ public function getEvents(string $userId, ?string $location = null): array { $calendarAppUrl = $this->urlGenerator->linkToRouteAbsolute('calendar.view.indexdirect.edit', $arguments); } + if (isset($event['objects'][0]['STATUS']) && $event['objects'][0]['STATUS'][0] === 'CANCELLED') { + return false; + } + return new UpcomingEvent( $event['uri'], ($event['objects'][0]['RECURRENCE-ID'][0] ?? null)?->getTimeStamp(), @@ -76,7 +80,7 @@ public function getEvents(string $userId, ?string $location = null): array { $event['objects'][0]['LOCATION'][0] ?? null, $calendarAppUrl, ); - }, $events); + }, $events)); } }