Add, change and delete calendar events from journal pages

CalDAV and Google calendars can now be written to from the journal on
the web and in the phone app. Each change goes to the source at once
with If-Match set to the ETag the last sync read, so a change made
elsewhere is refused (409) instead of overwritten; the account is then
read again. Repeating events, iCal feeds and read-only Google calendars
stay read-only.

- calendar_events keep each event's calendar, object/event id, ETag and
  whether it repeats; accounts keep their writable calendars and the
  one new events go to (migration 1764800000_calendar_writes).
- Google sign-in asks for calendar.events; older read-only accounts are
  offered "Connect again".
- New API: POST /calendar/events, PATCH and DELETE /calendar/events/{id}.
- Translations, Docs-Site guides and changelog updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tajniak81andClaude Opus 5.5 committed 2026-11-17 12:17:28 +01:00
1 parent 7f09338b60
commit 29465e4617
34 files changed
+3238 -223

No files matched your search

@@ -0,0 +1,48 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
/// <reference path="../pb_data/types.d.ts" />
// Writing to calendars (ADR-19): events of CalDAV and Google accounts can be
// added, changed and deleted from journal pages.
//
// - calendar_accounts.can_write: the account takes changes (CalDAV, or a
// Google account signed in with the events scope).
// - calendar_accounts.targets: the calendars of the account new events can go
// to, as [{id, name}] (CalDAV collection paths, Google calendar ids);
// write_to is the one chosen, empty for the first.
// - calendar_events.cal, ref, etag: where an occurrence's event is at the
// source (calendar, CalDAV object path or Google event id) and the ETag
// last read, sent as If-Match so a change made elsewhere is not
// overwritten. recurring marks occurrences of repeating events, which stay
// read-only.
migrate(
(app) => {
const accounts = app.findCollectionByNameOrId("calendar_accounts");
accounts.fields.add(new BoolField({ name: "can_write" }));
accounts.fields.add(new JSONField({ name: "targets", maxSize: 200000 }));
accounts.fields.add(new TextField({ name: "write_to", max: 2000 }));
app.save(accounts);
const events = app.findCollectionByNameOrId("calendar_events");
events.fields.add(new TextField({ name: "cal", max: 2000 }));
events.fields.add(new TextField({ name: "ref", max: 2000 }));
events.fields.add(new TextField({ name: "etag", max: 500 }));
events.fields.add(new BoolField({ name: "recurring" }));
events.indexes.push("CREATE INDEX idx_calendar_events_user_key ON calendar_events (user, key)");
app.save(events);
},
(app) => {
const accounts = app.findCollectionByNameOrId("calendar_accounts");
for (const name of ["can_write", "targets", "write_to"]) {
accounts.fields.removeByName(name);
}
app.save(accounts);
const events = app.findCollectionByNameOrId("calendar_events");
for (const name of ["cal", "ref", "etag", "recurring"]) {
events.fields.removeByName(name);
}
events.indexes = events.indexes.filter((i) => !i.includes("idx_calendar_events_user_key"));
app.save(events);
},
);