fix: cancel only the tapped occurrence on single-instance recurring delete (Codeberg #47) #68
Reference in New Issue
Block a user
Delete Branch "fix/recurring-single-delete"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes Codeberg #47 — https://codeberg.org/jlmakiola/calendula/issues/47
(reported on v2.14.0, Pixel 9a / Android 17).
The bug
"Delete only this event" on a recurring series did the inverse of what it
promised: it wiped every other occurrence, left the tapped one behind as a
"cancelled" ghost, and re-deleting toggled the whole series back.
Root cause
AndroidCalendarDataSource.deleteOccurrencewrote a cancelled exception carryingonly
ORIGINAL_INSTANCE_TIME+STATUS_CANCELED. WithoutDTSTART+DURATIONthe provider clones the master with its RRULE intact and cancels the whole
clone — the exact trap the edit path already documents (Codeberg #16, see
buildOccurrenceExceptionValuesKDoc). The single-instance delete path never gotthe same discipline.
Fix
DTSTART+DURATION+ timezone +all-day, read from the series row — so the provider clears the inherited RRULE
and cancels only that occurrence. Extracted into a pure
buildOccurrenceCancelValueshelper with JVM tests.STATUS_CANCELEDout of theinstances()grid query (keepingNULLstatus — a normal event) so the cancelled occurrence disappears instead of
lingering as a tappable ghost. This is what kills symptoms #2 (cancelled label)
and #3 (restore-on-re-delete).
The other two scopes ("this and following", "all events") were already correct
and are untouched.
Testing
./gradlew test lintgreen locally; addedEventWriteMapperTestcoverage forthe new helper.
STATUS filter both need a real device before merge/release.
🤖 Generated with Claude Code