Forget pushed event ids when Google Calendar is disconnected (Feature 16)
Disconnect deleted the connection but left every pushed plan synced with its stored event ids, though no calendar was chosen any more. It now deletes the connection and runs the same invalidation as choosing another calendar (forgetEvents: MarkCalendarPlansEdited, ClearCalendarEvents) in one transaction, under the account lock. A refused revoke still changes nothing. Tests push three weeks, disconnect, and check each is changed with no event id; then connect again, choose a calendar and push the whole week to it. Also: a refused revoke keeps every week synced, and a disconnect during a push waits for its record and then forgets it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -64,8 +64,9 @@ type pushDay struct {
|
||||
// calendar_event_id is empty. When every day has one, Calendar shows the
|
||||
// whole plan and every day is written again, which puts back anything
|
||||
// changed in Calendar since: the app is the source of truth. A stored event
|
||||
// id is always on the chosen calendar: choosing another clears them all
|
||||
// (gcal.Service.SelectCalendar), so the next push writes the whole week.
|
||||
// id is always on the chosen calendar: choosing another
|
||||
// (gcal.Service.SelectCalendar) or disconnecting (gcal.Service.Disconnect)
|
||||
// clears them all, so the next push writes the whole week.
|
||||
//
|
||||
// Only a push that wrote every one of those events is recorded: the plan
|
||||
// becomes synced with calendar_synced_at now, and each day written stores
|
||||
@@ -74,7 +75,8 @@ type pushDay struct {
|
||||
// updates the events already written rather than adding them twice. The
|
||||
// push is recorded while the calendar written to is still the chosen one.
|
||||
// A plan edited while it was pushed, or whose events were forgotten by
|
||||
// choosing another calendar, fails with ErrPlanChanged, unrecorded.
|
||||
// choosing another calendar or disconnecting, fails with ErrPlanChanged,
|
||||
// unrecorded.
|
||||
//
|
||||
// The week must have a plan (else ErrNotFound). The calendar's errors are
|
||||
// returned as they are: gcal.ErrNotConnected, gcal.ErrNoCalendar,
|
||||
|
||||
Reference in New Issue
Block a user