Merge pull request #54112 from nextcloud/backport/53992/stable30

[stable30] fix(caldav): don't return cancelled events for upcoming events API
This commit is contained in:
Anna 2025-07-28 14:47:07 +02:00 committed by GitHub
commit 62d2224ceb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -45,7 +45,7 @@ class UpcomingEventsService {
$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) {
@ -65,6 +65,10 @@ class UpcomingEventsService {
$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(),
@ -74,7 +78,7 @@ class UpcomingEventsService {
$event['objects'][0]['LOCATION'][0] ?? null,
$calendarAppUrl,
);
}, $events);
}, $events));
}
}