]> source.dussan.org Git - nextcloud-server.git/commit
fix(caldav): event search with limit and timerange
authorDaniel Kesselberg <mail@danielkesselberg.de>
Tue, 7 May 2024 13:55:47 +0000 (15:55 +0200)
committerDaniel <mail@danielkesselberg.de>
Thu, 6 Jun 2024 10:29:29 +0000 (12:29 +0200)
commit449af33c29d5337ba33592c62337816b1a086a54
treed9f7df97bbaf1af92af70bf12e3c79c1b3ac1786
parentb6efc89f7838241751b7f9fb436406b16d19a64e
fix(caldav): event search with limit and timerange

Event recurrences are evaluated at runtime because the database only knows the first and last occurrence.

Given, a user created 8 events with a yearly reoccurrence and two for events tomorrow.
The upcoming event widget asks the CalDAV backend for 7 events within the next 14 days.

If limit 7 is applied to the SQL query, we find the 7 events with a yearly reoccurrence and discard the events after evaluating the reoccurrence rules because they are not due within the next 14 days and end up with an empty result even if there are two events to show.

The workaround for search requests with a limit and time range is asking for more row than requested and retrying if we have not reached the limit.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
apps/dav/lib/CalDAV/CalDavBackend.php
apps/dav/tests/misc/caldav-search-limit-timerange-1.ics [new file with mode: 0644]
apps/dav/tests/misc/caldav-search-limit-timerange-2.ics [new file with mode: 0644]
apps/dav/tests/misc/caldav-search-limit-timerange-3.ics [new file with mode: 0644]
apps/dav/tests/misc/caldav-search-limit-timerange-4.ics [new file with mode: 0644]
apps/dav/tests/misc/caldav-search-limit-timerange-5.ics [new file with mode: 0644]
apps/dav/tests/misc/caldav-search-limit-timerange-6.ics [new file with mode: 0644]
apps/dav/tests/unit/CalDAV/CalDavBackendTest.php