Merge feat/325-copy-events into release/2.25.0
# Conflicts: # floret-kit
This commit is contained in:
commit
3bc2240407
25 files changed
+1882
-285
No files matched your search
+56
-9
@@ -586,15 +586,62 @@ of the backup keeps its last one. The pre-#411 fixed `calendula-backup.ics` is
|
||||
the combined series' stable copy for the install that wrote it, and an
|
||||
install that already had a folder stays on the combined layout.
|
||||
|
||||
**A backup carries the series' deleted occurrences.** `EXDATE` lives on the
|
||||
master row, so the export query's `ORIGINAL_ID IS NULL` filter — which does drop
|
||||
`RECURRENCE-ID` overrides — never hid it; it simply wasn't read. It is now part
|
||||
of `EventExportProjection`, and `IcsWriter` marks an all-day series' exclusions
|
||||
`VALUE=DATE`, because RFC 5545 ties `EXDATE`'s value type to `DTSTART`'s and a
|
||||
bare day code without it reads as a malformed DATE-TIME. Sync adapters disagree
|
||||
on whether an all-day exclusion is `yyyyMMdd` or a padded midnight stamp, so
|
||||
`exportExDates` drops the time part on the way out. Without this, an in-app
|
||||
backup→restore resurrected every occurrence the user had deleted.
|
||||
**A backup carries the series' deleted and moved occurrences.** `EXDATE` lives on
|
||||
the master row and is part of `EventExportProjection`; `IcsWriter` marks an
|
||||
all-day series' exclusions `VALUE=DATE`, because RFC 5545 ties `EXDATE`'s value
|
||||
type to `DTSTART`'s and a bare day code without it reads as a malformed
|
||||
DATE-TIME. Sync adapters disagree on whether an all-day exclusion is `yyyyMMdd`
|
||||
or a padded midnight stamp, so `exportExDates` drops the time part on the way
|
||||
out.
|
||||
|
||||
A synced calendar records a deleted or moved occurrence as an *exception row*
|
||||
(`ORIGINAL_ID` / `ORIGINAL_SYNC_ID` = the series, `ORIGINAL_INSTANCE_TIME` = the
|
||||
occurrence) instead, and neither a backup file nor a copied calendar can hold
|
||||
one: an `.ics` restore skips `RECURRENCE-ID` overrides, and an inserted row has
|
||||
no `_sync_id` for an exception to attach through. `CalendarDataSource.calendarRows`
|
||||
therefore reads every row, exceptions included, and `flattenOverrides` — the one
|
||||
place this mapping lives, shared by the backup (`exportEvents`) and Copy events
|
||||
(#325, `planCalendarCopy`) — writes them the way Calendula writes "only this
|
||||
event" on an unsynced series: every exception adds its occurrence to the
|
||||
series' `EXDATE`, and a modified one becomes a standalone event at its own
|
||||
times. Its UID is derived from the series UID and the occurrence, so it is the
|
||||
same in every backup, and it carries the series UID as `X-CALENDULA-OVERRIDE-OF`.
|
||||
`importEvents` skips such an occurrence wherever its series already is — that
|
||||
series there has the override itself — so restoring into the calendar a backup
|
||||
came from adds nothing twice, while a restore into an empty one gets both. The
|
||||
standalone event also names its occurrence (`X-CALENDULA-OVERRIDE-AT`); if it
|
||||
fails to insert, the series is inserted without that exclusion, so the
|
||||
occurrence stays at its original time rather than vanishing for good. The
|
||||
import inserts every such event ahead of the series, whatever order the file
|
||||
lists them in.
|
||||
Exceptions whose series isn't among the rows are left out, a cancelled
|
||||
series' moved occurrences stay cancelled, and sync ids link only within their
|
||||
own calendar. Backups made before this carry no exceptions and restore exactly
|
||||
as before.
|
||||
|
||||
**`RDATE` travels like `EXDATE` (#515).** A series can repeat by listed dates
|
||||
alone. The provider stores `RDATE` in the same `<zone>;<stamps>` form as
|
||||
`EXDATE`, so `exportRecurrenceDates` resolves it the same way to UTC stamps (or
|
||||
bare days for an all-day series), line by line where several `RDATE`s were
|
||||
stored; a `PERIOD` entry keeps its start, and a bare day on a timed series
|
||||
becomes the occurrence at the series' time of day, so the copy (which never
|
||||
goes through the parser) and a file get the same stamps. `IcsWriter`
|
||||
writes it as `RDATE:` / `RDATE;VALUE=DATE:`, anchors such a series to its zone
|
||||
like an RRULE series, and writes its `EXDATE` too; `IcsParser` reads `RDATE`
|
||||
through the same normalisation as `EXDATE`, so a foreign `TZID` or floating
|
||||
value lands on the right instant. Older backups wrote such a series as a single
|
||||
event and still restore as one.
|
||||
|
||||
**Copying a calendar.** Backup & restore → Copy events (#325) runs the source's
|
||||
flattened rows straight into `importEvents`, so the UID dedup makes a re-run skip
|
||||
what landed before. It skips the `.ics` text: the writer pins a timed one-off to
|
||||
UTC and carries no colour or visibility; the direct mapping keeps them.
|
||||
Attendees and organizer are never read, and cancelled events and declined
|
||||
invitations are left out (an insert can't be cancelled; it would arrive live, and
|
||||
a declined occurrence counts as deleted, as does one of a declined series the
|
||||
user didn't accept on its own). A re-run is idempotent per
|
||||
snapshot: a series already in the target keeps its overrides, so an occurrence
|
||||
changed since keeps its earlier copy rather than gaining a second one.
|
||||
|
||||
That re-encode is sampled where the reminder will actually *fire*, not at
|
||||
`DTSTART` (`importedAllDayReminderDate`). An imported series' `DTSTART` is only an
|
||||
|
||||
Reference in new issue
Block a user