Repository navigation
Use the revision of an override with the highest SEQUENCE - #115
Merged
Merged
Conversation
Several components with the same UID and RECURRENCE-ID are revisions of one instance. All of them were returned as occurrences; now only the one with the highest SEQUENCE applies, the later one in the calendar when they are equal (RFC 5545, section 3.8.7.4). - Item::overrides() returns the current revisions, matched as instants like the expansion (or as days for date-only IDs of a timed series), also for RANGE=THISANDFUTURE overrides - IcalParser::getEvents() skips superseded revisions and _RECURRENCE_IDS keeps the current one; the RECURRENCE-ID is compared as written
- RANGE is part of the instance identity: a THISANDFUTURE override and a single override with the same RECURRENCE-ID are no longer revisions of each other (the range was dropped and later instances fell back) - IcalParser keys revisions by RANGE, TZID and RECURRENCE-ID, so the same local time in another timezone no longer removes an override and brings back the original instance - revisions of overrides without their recurring item and of items without DTSTART are resolved in the new API too, like in IcalParser - overrides() keeps the order of the calendar - IcalParser reads SEQUENCE like the new API (invalid values are 0) - the RFC 5545 reference is attached to SEQUENCE, the tie-break is our own
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Several components with the same UID and RECURRENCE-ID are revisions of one instance. Both APIs returned all of them as occurrences, so a calendar with an updated override showed the instance twice: once at the old time, once at the new one.
Now only the revision with the highest SEQUENCE (RFC 5545, section 3.8.7.4) applies; a missing or invalid SEQUENCE is 0 and of equal revisions the later component wins (our tie-break, the RFC does not define one).
Item::overrides()returns the current revisions in the order of the calendar. Instances are matched like the expansion matches them (as instants in any timezone, or as days for date-only IDs of a timed series), andRANGEis part of the identity, so a THISANDFUTURE override and a single override of the same instance both stay in effect. Revisions of overrides without their recurring item and of items without DTSTART are resolved too.IcalParser::getEvents()skips superseded revisions and_RECURRENCE_IDSkeeps the current one. The RECURRENCE-ID is compared as written together with itsTZIDandRANGE(the master's timezone is not known when an override is registered);$data['VEVENT']itself still contains every component.Not changed: overrides do not inherit missing properties from the master, revisions of the master itself (same UID without RECURRENCE-ID) are not resolved, and DTSTAMP is not used as a tie-break (RFC 5546, section 2.1.5).
Tests
Fixtures/Regression/duplicate-override-sequence.ics: a daily series with three duplicated overrides (higher SEQUENCE first, equal SEQUENCE, SEQUENCE vs none), checked with both APIs inregressions.phpt; fails without the fix.regressions.phptalso covers a UTC and a TZID RECURRENCE-ID of the same instant, duplicated THISANDFUTURE overrides, a THISANDFUTURE and a single override of one instance, the same local time in two timezones (both APIs), orphan revisions (both APIs), a task without DTSTART, the order ofoverrides()and an invalid SEQUENCE (both APIs). The cases fixed by the review commit fail on the first commit; the two-timezone case of the new API is a guard (it passes on both).composer checkpasses; no existing golden file or snapshot changed.