Skip to content

Commit 3b4a268

Browse files
authored
Merge pull request #53992 from nextcloud/fix/noid/filter-cancelled-events
fix(caldav): don't return cancelled events for upcoming events API
2 parents aca5361 + 7e3082c commit 3b4a268

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 (isset($event['objects'][0]['STATUS']) && $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)