Skip to content

Commit 35cf5e4

Browse files
committed
fix(caldav): don't return cancelled events for upcoming events API
Signed-off-by: Anna Larch <[email protected]>
1 parent 2cbfdcc commit 35cf5e4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

apps/dav/lib/CalDAV/UpcomingEventsService.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function getEvents(string $userId, ?string $location = null): array {
4747
$this->userManager->get($userId),
4848
);
4949

50-
return array_map(function (array $event) use ($userId, $calendarAppEnabled) {
50+
return array_filter(array_map(function (array $event) use ($userId, $calendarAppEnabled) {
5151
$calendarAppUrl = null;
5252

5353
if ($calendarAppEnabled) {
@@ -67,6 +67,10 @@ public function getEvents(string $userId, ?string $location = null): array {
6767
$calendarAppUrl = $this->urlGenerator->linkToRouteAbsolute('calendar.view.indexdirect.edit', $arguments);
6868
}
6969

70+
if ($event['objects'][0]['STATUS'][0] === 'CANCELLED') {
71+
return false;
72+
}
73+
7074
return new UpcomingEvent(
7175
$event['uri'],
7276
($event['objects'][0]['RECURRENCE-ID'][0] ?? null)?->getTimeStamp(),
@@ -76,7 +80,7 @@ public function getEvents(string $userId, ?string $location = null): array {
7680
$event['objects'][0]['LOCATION'][0] ?? null,
7781
$calendarAppUrl,
7882
);
79-
}, $events);
83+
}, $events));
8084
}
8185

8286
}

0 commit comments

Comments
 (0)