diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fab0761..b5e4d023 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,15 @@ exact tag (`ghcr.io/calnode/calnode:0.1.0`) if you need stability between upgrad ## [Unreleased] ### Added +- **Unlisted event types.** Create and edit forms now offer Public, Unlisted and Private + visibility, shown in the admin list and read-only details. Active Unlisted event types + accept normal bookings through their existing URLs without appearing in person or team + directories; anyone with the link can book without signing in. Active remains independent, + and existing Public/Private behavior is preserved. Migration 00072 adds a default-off + `is_unlisted` flag while retaining the `is_public` booking gate. Create/PATCH accepts + `visibility`; legacy `is_public` PATCH requests still select Public/Private. New event + types default to Public; duplicates retain visibility and start inactive. Migration rollback + makes Unlisted types Private so an older binary cannot unexpectedly list them. - **French localization of the admin UI.** The SvelteKit admin (`frontend/`) now has a lightweight i18n layer (`frontend/src/lib/i18n/`) with English as the source of truth and a complete French catalog written by a native speaker. The language is chosen in diff --git a/README.md b/README.md index 4ce56269..6291089e 100644 --- a/README.md +++ b/README.md @@ -183,6 +183,7 @@ domains, Resend email, Google & Microsoft OAuth, Litestream backups, troubleshoo **Shipped** - Event types with per-type duration, location, custom questions, custom email copy +- Public, **Unlisted** (direct link only), or Private event-type visibility - DST-correct availability (working hours, day-of-week rules, date overrides) - Team routing: **fixed · round-robin · collective · priority** - **Google Calendar & Microsoft 365 / Outlook** — native free/busy conflict checks @@ -218,6 +219,20 @@ domains, Resend email, Google & Microsoft OAuth, Litestream backups, troubleshoo **On the roadmap** - OpenAPI spec · `/metrics` · multi-domain (one instance, many hostnames) +### Event-type visibility + +Choose **Visibility** when creating an event type, or open an existing event type's +**General** tab, choose a visibility and save: + +- **Public** (the default): listed in person/team directories and bookable through its URL. +- **Unlisted**: hidden from those directories, but bookable through the same `/book/{slug}` URL. +- **Private**: hidden from directories and inaccessible through the public booking URL. + +Keep **Active** enabled to accept bookings. Inactive types are unbookable and absent from +directories in every visibility state. Unlisted is discoverability, not access control: +anyone with the link can book without signing in. For API compatibility and migration +details, see [the visibility model](docs/ARCHITECTURE.md#14-visibility-model). + --- ## Stack diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 0856972d..c641f80a 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -69,8 +69,9 @@ app you must `pnpm build` in `frontend/` **and** rebuild/restart the Go binary ## 4. Persistence (SQLite) — and the single-connection rule -Public person (`/u/{handle}`) and team (`/team/{slug}`) directories list public, -active event types by `display_order` ascending, then name and unique slug for +Public person (`/u/{handle}`) and team (`/team/{slug}`) directories list active event +types with **Public** visibility (excluding Unlisted and Private; see §14), by +`display_order` ascending, then name and unique slug for deterministic ties. The integer defaults to 0, preserving alphabetical order for existing types. Owners can set it through event-type create/PATCH or the event editor's Directory order field; negative values put an event ahead of the default @@ -79,7 +80,7 @@ It does not affect the admin event-type list or team member roster ordering. - `internal/db`: opens SQLite with **`SetMaxOpenConns(1)`** + `SetMaxIdleConns(1)`, **WAL** journal mode, `busy_timeout=5000`. One writer connection by design. -- Migrations: **goose** SQL files in `internal/db/migrations/` (00001→00029). Run +- Migrations: numbered **goose** SQL files embedded from `internal/db/migrations/`. Run automatically on startup. `ALTER TABLE ADD COLUMN` is reversible-by-convention only (SQLite can't easily drop columns). @@ -106,7 +107,9 @@ partial unique index covers) — no TOCTOU between concurrent bookings. `invite_tokens` (hashed, single-use). **There is no `auth_providers` table** — OAuth identity is columns on `users` (migration 00012). - **Teams:** `teams`, `team_members` (with `routing_priority`). -- **Event types:** `event_types` (+ `routing_mode` — CHECK has **four** values: +- **Event types:** `event_types` (+ `is_active`, independent of visibility; + `is_public` gates direct booking and `is_unlisted` suppresses directory listing — §14; + `routing_mode` — CHECK has **four** values: fixed | round_robin | collective | priority; `rr_strategy`; `max_active_bookings` (per-invitee cap, enforced); `seat_limit` (group/class — column exists but is **not enforced**); `team_id` — vestigial for routing), `event_type_hosts` @@ -818,6 +821,26 @@ as the desired state: ## 14. Visibility model +Event types have three visibility choices, independent of **Active**: + +- **Public** (the default): direct booking is accessible and the event type is listed + in the existing person/team directories. +- **Unlisted**: direct booking works normally, but directories omit the event type. + Anyone with the URL can book without signing in; this is discoverability, not access control. +- **Private**: direct booking is inaccessible and directories omit the event type. + +Inactive event types remain unbookable and absent from directories in every visibility +state. Administration lists and manages all three states under the existing ownership rules. +Create/PATCH accepts `visibility` (`public`, `unlisted`, `private`); admin responses include it. +Migration 00072 adds `is_unlisted` (default 0), retaining `is_public` as the direct-booking +gate so all existing Public/Private values and booking checks stay unchanged. Direct booking, +slots, questions, embeds and the assistant use that gate; only the directory queries check +`is_unlisted`. The authenticated MCP booking catalog retains its existing bookability filter. +Legacy PATCH clients can still use `is_public` to choose Public/Private (clearing Unlisted). +If both fields are sent they must agree on direct accessibility; `visibility` sets the state. +Duplication keeps visibility and still starts inactive. Rolling migration 00072 back makes +Unlisted types Private, avoiding unexpected directory publication by an older binary. + - Members see **only bookings they host** — `ListByHost` matches `bookings.host_id` **OR** any `booking_hosts` seat, so Group/fixed non-primary attendees see meetings they're on (not just the ones they lead). diff --git a/docs/i18n-glossary.md b/docs/i18n-glossary.md index 2ee884b5..e5898151 100644 --- a/docs/i18n-glossary.md +++ b/docs/i18n-glossary.md @@ -35,6 +35,10 @@ not have to invent terminology that is already decided. | round robin | round robin | - | tourniquet | French admin uses "tourniquet"; do not calque "tourner entre eux". | | reminder | reminder | rappel | rappel | | | directory | directory | - | annuaire | Only the person and team pages. | +| event-type visibility | Visibility | - | Visibilité | Admin key: `eventTypes.visibility.label`. Independent of Active. | +| public event type | Public | - | Public | Admin key: `eventTypes.visibility.public`. Listed and bookable when active. | +| unlisted event type | Unlisted | - | Non répertorié | Admin key: `eventTypes.visibility.unlisted`. Hidden from directories; anyone with the link can book when active. | +| private event type | Private | - | Privé | Admin key: `eventTypes.visibility.private`. No public booking access or directory listing. | ## Register diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index cd6c8723..98f17211 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -34,7 +34,9 @@ export type EventType = { // duration on create; editable so a 45-minute meeting can still be offered on the hour. slot_interval_minutes: number; is_active: boolean; + /** Direct-booking gate, true for both Public and Unlisted. */ is_public: boolean; + visibility: 'public' | 'unlisted' | 'private'; /** Show already-booked times struck through on the booking page instead of hiding * them. Off by default: the slots endpoint is public, so this makes the host's * booked hours visible to anyone with the link. */ diff --git a/frontend/src/lib/components/event-types/VisibilitySelect.svelte b/frontend/src/lib/components/event-types/VisibilitySelect.svelte new file mode 100644 index 00000000..0b957231 --- /dev/null +++ b/frontend/src/lib/components/event-types/VisibilitySelect.svelte @@ -0,0 +1,23 @@ + + +
{$t(`eventTypes.visibility.hint.${value}`)}
+