Skip to content

Auto-create Google Calendar event after scheduling a poll #79

@zhiganov

Description

@zhiganov

Goal

When the creator clicks "Schedule" on a poll, also insert a Google Calendar event into a shared calendar of their choice — picked from a dropdown of their writable calendars in the scheduling toolbar.

This is the missing piece for community workflows where the shared calendar is the source of truth (e.g., sensemakingscenius@gmail.com, where every member is subscribed). Today the creator has to manually copy the time/title/description over after scheduling.

Spec & plan

The plan is fully decomposed into 5 tasks with exact code blocks and commands. Execute it with the superpowers:subagent-driven-development skill (one fresh subagent per task) or superpowers:executing-plans (inline batched).

Scope

v1 — in scope:

  • Creator picks one of their own writable Google Calendars at schedule time. Inherits write access through their existing membership on the shared calendar — no service account.
  • Choice remembered per-creator in localStorage.
  • Scope upgrade from calendar.readonly to calendar.events via incremental GIS consent.
  • Calendar insert runs after finalizePoll succeeds; calendar failure never rolls back the schedule.

Out of scope (deferred):

  • Service-account flow.
  • Per-community calendar pre-config — filed as Citizen-Infra/community-admin#12.
  • Adding participants as event attendees.
  • Auto-cancel/update of the Google event when a poll is unscheduled or re-scheduled (would need lexicon change to track googleEventId).
  • Adding a client-side test runner — keep avails' "no client tests, manual smoke" pattern.

Files to change

File Change
client/src/lib/googleCalendar.js Add scope constants, parameterise requestGoogleAccess, add listWritableCalendars and insertEvent.
client/src/components/SchedulingGrid.jsx Add the "Add to" picker / connect link to the toolbar.
client/src/pages/PollView.jsx Hold writable-calendars + chosen-calendar + token state; persist to localStorage; insert event after finalize; render success link / retry-able error.

No server changes. No lexicon changes. No new dependencies.

Definition of done

  1. Plan tasks 1–5 executed, each with its own commit per the plan.
  2. Smoke test (plan Task 5) walked end-to-end — happy path, don't-add, localStorage default, OAuth refused, retry, re-schedule orphan.
  3. Pushed and deployed to Railway (avails.zhgnv.com).
  4. Verified live by scheduling a real poll into the Sensemaking Scenius shared calendar.
  5. This issue closed referencing the merge commit.

Follow-up after v1

When/if persisting googleEventId and googleCalendarId on the poll lexicon becomes worth doing, revisit:

  • Auto-cancel orphan Google event on handleUnschedule.
  • Auto-update on re-schedule.
  • Per-community defaults pulled from community-admin#12.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions