The "Upcoming events" widget (provided by the calendar app) is using ICalendar.search / CalDavBackend.search to obtain a list of calendar objects within a given time range since calendar 4.6.0. Former versions sent one xhr request per calendar to the CalDAV api to obtain the calendar objects.
A user also mentioned that tasks (e.g. from the tasks app) were shown in the "Upcoming events" widget with older version and now are missing^1.
I had a brief look with the tasks app and found a couple of things:
"Upcoming events" use a search with a time range. That's done by filtering on oc_calendarobjects.firstoccurence and oc_calendarobjects.lastoccurence and additional processing. However, event's from the tasks app with a start and end date still ended up in oc_calendarobjects with firstoccurrence = null and lastoccurence = null.
The processing for DTSTART in CalDavBackend.getDenormalizedData is only done for VEVENTS^2.
VTODO don't have DTEND but DUE or DURATION^3. We can handle DURATION, but DUE is missing^4.
CalDavBackend.search uses a comp-filter to check if the given event is within the time range. The filter for component type "name" is mandatory and set to VEVENT and will remove VTODO or VJOURNAL. The component type is already known (from the db result) and can be reused or drop the filter and ask the components directly with isInTimeRange^5.
CalDavBackend.search uses VCalendar.expand to return the event for the given date and without recurrences. The implemention does not take VTODO in account and therefore they are removed / not added to the expanded result^6.
Follow-up for https://github.com/nextcloud/server/pull/44752 and https://github.com/nextcloud/server/pull/45222
The "Upcoming events" widget (provided by the calendar app) is using ICalendar.search / CalDavBackend.search to obtain a list of calendar objects within a given time range since calendar 4.6.0. Former versions sent one xhr request per calendar to the CalDAV api to obtain the calendar objects.
A user also mentioned that tasks (e.g. from the tasks app) were shown in the "Upcoming events" widget with older version and now are missing^1.
I had a brief look with the tasks app and found a couple of things:
"Upcoming events" use a search with a time range. That's done by filtering on oc_calendarobjects.firstoccurence and oc_calendarobjects.lastoccurence and additional processing. However, event's from the tasks app with a start and end date still ended up in oc_calendarobjects with firstoccurrence = null and lastoccurence = null.
Proof of concept to bring back tasks in the "Upcoming events" widget.
Alternative for
$isValid = $this->validateFilterForObject