Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
31 changes: 27 additions & 4 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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).

Expand All @@ -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`
Expand Down Expand Up @@ -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).
Expand Down
4 changes: 4 additions & 0 deletions docs/i18n-glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
23 changes: 23 additions & 0 deletions frontend/src/lib/components/event-types/VisibilitySelect.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script lang="ts">
import type { EventType } from '$lib/api';
import { Label } from '$lib/components/ui/label';
import * as Select from '$lib/components/ui/select';
import { t } from '$lib/i18n';

let { value = $bindable('public') }: { value?: EventType['visibility'] } = $props();
</script>

<div class="space-y-1.5">
<Label for="et-visibility">{$t('eventTypes.visibility.label')}</Label>
<Select.Root type="single" bind:value>
<Select.Trigger id="et-visibility" class="w-full" aria-describedby="et-visibility-hint">
{$t(`eventTypes.visibility.${value}`)}
</Select.Trigger>
<Select.Content>
<Select.Item value="public">{$t('eventTypes.visibility.public')}</Select.Item>
<Select.Item value="unlisted">{$t('eventTypes.visibility.unlisted')}</Select.Item>
<Select.Item value="private">{$t('eventTypes.visibility.private')}</Select.Item>
</Select.Content>
</Select.Root>
<p id="et-visibility-hint" class="text-xs text-muted-foreground">{$t(`eventTypes.visibility.hint.${value}`)}</p>
</div>
32 changes: 32 additions & 0 deletions frontend/src/lib/components/event-types/VisibilitySelect.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { afterEach, expect, test } from 'vitest';
import { page } from 'vitest/browser';
import { cleanup, render } from 'vitest-browser-svelte';
import VisibilitySelect from './VisibilitySelect.svelte';
import { setLocale } from '$lib/i18n';

afterEach(cleanup);

test('visibility defaults to Public and explains each selection', async () => {
setLocale('en');
await render(VisibilitySelect);
const control = page.getByRole('button', { name: 'Visibility' });
await expect.element(control).toHaveTextContent('Public');
await expect.element(page.getByText('Listed in public directories and bookable by anyone with the link.')).toBeVisible();

for (const [label, hint] of [
['Unlisted', 'Hidden from public directories. Anyone with the link can book; no sign-in is required.'],
['Private', 'Hidden from public directories and unavailable through the public booking link.'],
['Public', 'Listed in public directories and bookable by anyone with the link.']
]) {
await control.click();
await page.getByRole('option', { name: label, exact: true }).click();
await expect.element(control).toHaveTextContent(label);
await expect.element(page.getByText(hint, { exact: true })).toBeVisible();
}
});

test('an existing Unlisted value is displayed on load', async () => {
setLocale('en');
await render(VisibilitySelect, { props: { value: 'unlisted' } });
await expect.element(page.getByRole('button', { name: 'Visibility' })).toHaveTextContent('Unlisted');
});
17 changes: 12 additions & 5 deletions frontend/src/lib/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,17 @@
}
},
"eventTypes": {
"visibility": {
"label": "Visibility",
"public": "Public",
"unlisted": "Unlisted",
"private": "Private",
"hint": {
"public": "Listed in public directories and bookable by anyone with the link.",
"unlisted": "Hidden from public directories. Anyone with the link can book; no sign-in is required.",
"private": "Hidden from public directories and unavailable through the public booking link."
}
},
"headTitle": "Event Types — Calnode",
"title": "Event Types",
"subtitle": {
Expand Down Expand Up @@ -1597,9 +1608,7 @@
},
"status": {
"active": "Active",
"inactive": "Inactive",
"listed": "Listed",
"unlisted": "Unlisted (link only)"
"inactive": "Inactive"
},
"durationSuffix": " min"
},
Expand All @@ -1622,8 +1631,6 @@
"descriptionPlaceholder": "Optional — supports **bold** and *italic* markdown",
"status": "Status",
"active": "Active (accepting bookings)",
"visibility": "Visibility",
"public": "Public (visible in booking page)",
"showTaken": "Show booked times as unavailable",
"showTakenHint": "Booked times appear struck through on the booking page instead of being hidden, so visitors can see the calendar filling up. Only times inside your working hours are shown, never the rest of your day.",
"showTakenWarning": "Anyone with the booking link can see which hours are taken.",
Expand Down
17 changes: 12 additions & 5 deletions frontend/src/lib/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,17 @@
}
},
"eventTypes": {
"visibility": {
"label": "Visibilité",
"public": "Public",
"unlisted": "Non répertorié",
"private": "Privé",
"hint": {
"public": "Visible dans les annuaires publics. Toute personne disposant du lien peut réserver.",
"unlisted": "Masqué dans les annuaires publics. Toute personne disposant du lien peut réserver, sans connexion.",
"private": "Masqué dans les annuaires publics et inaccessible via le lien de réservation public."
}
},
"headTitle": "Types de rendez-vous — Calnode",
"title": "Types de rendez-vous",
"subtitle": {
Expand Down Expand Up @@ -1597,9 +1608,7 @@
},
"status": {
"active": "Actif",
"inactive": "Inactif",
"listed": "Répertorié",
"unlisted": "Non répertorié (lien uniquement)"
"inactive": "Inactif"
},
"durationSuffix": " min"
},
Expand All @@ -1622,8 +1631,6 @@
"descriptionPlaceholder": "Facultatif — prend en charge le markdown **gras** et *italique*",
"status": "Statut",
"active": "Actif (accepte les réservations)",
"visibility": "Visibilité",
"public": "Public (visible sur la page de réservation)",
"showTaken": "Afficher les horaires réservés comme indisponibles",
"showTakenHint": "Les horaires réservés apparaissent barrés sur la page de réservation au lieu d'être masqués, afin que les visiteurs voient le calendrier se remplir. Seuls les horaires dans vos heures de travail sont affichés, jamais le reste de votre journée.",
"showTakenWarning": "Quiconque dispose du lien de réservation peut voir quels horaires sont pris.",
Expand Down
10 changes: 7 additions & 3 deletions frontend/src/routes/event-types/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import VisibilitySelect from '$lib/components/event-types/VisibilitySelect.svelte';
import { onMount } from 'svelte';
import { api, type EventType } from '$lib/api';
import { currentUser } from '$lib/stores';
Expand All @@ -16,7 +17,7 @@
let loading = $state(true);
let showCreate = $state(false);

let form = $state({ slug: '', name: '', description: '', duration_minutes: 30 });
let form = $state({ slug: '', name: '', description: '', duration_minutes: 30, visibility: 'public' as EventType['visibility'] });
let creating = $state(false);
let deleteOpen = $state(false);
let deleteSlug = $state('');
Expand Down Expand Up @@ -74,9 +75,10 @@
slug: form.slug,
name: form.name,
description: form.description || undefined,
duration_minutes: Number(form.duration_minutes)
duration_minutes: Number(form.duration_minutes),
visibility: form.visibility
});
form = { slug: '', name: '', description: '', duration_minutes: 30 };
form = { slug: '', name: '', description: '', duration_minutes: 30, visibility: 'public' as EventType['visibility'] };
showCreate = false;
await load();
} catch (e: any) {
Expand Down Expand Up @@ -197,6 +199,7 @@
<Label for="et-desc">{$t('eventTypes.new.description')}</Label>
<Input id="et-desc" bind:value={form.description} placeholder={$t('eventTypes.new.descriptionPlaceholder')} />
</div>
<VisibilitySelect bind:value={form.visibility} />
</div>
<Button onclick={create} disabled={creating}>
{creating ? $t('eventTypes.new.creating') : $t('eventTypes.new.create')}
Expand Down Expand Up @@ -239,6 +242,7 @@
<td class="px-4 py-3">
<div class="flex items-center gap-2">
<span class="font-medium">{et.name}</span>
<Badge variant="outline">{$t(`eventTypes.visibility.${et.visibility}`)}</Badge>
{#if et.owned === false && scope === 'mine'}
<Badge variant="secondary" class="text-[10px]">{$t('eventTypes.badge.youHost')}</Badge>
{/if}
Expand Down
17 changes: 6 additions & 11 deletions frontend/src/routes/event-types/[slug]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import VisibilitySelect from '$lib/components/event-types/VisibilitySelect.svelte';
import { onMount } from 'svelte';
import { page } from '$app/stores';
import { goto } from '$app/navigation';
Expand Down Expand Up @@ -86,7 +87,7 @@
let form = $state({
display_order: 0,
name: '', slug: '', description: '', duration_minutes: 30, slot_interval_minutes: 30,
is_active: true, is_public: true, show_taken_slots: false,
is_active: true, visibility: 'public' as EventType['visibility'], show_taken_slots: false,
invite_delivery: 'calendar' as EventType['invite_delivery'],
location_type: 'link', location_value: '',
buffer_before_minutes: 0, buffer_after_minutes: 0,
Expand Down Expand Up @@ -333,7 +334,7 @@
duration_minutes: et.duration_minutes,
slot_interval_minutes: et.slot_interval_minutes,
is_active: et.is_active,
is_public: et.is_public,
visibility: et.visibility,
show_taken_slots: et.show_taken_slots ?? false,
invite_delivery: et.invite_delivery ?? 'calendar',
location_type: et.location_type,
Expand Down Expand Up @@ -394,7 +395,7 @@
duration_minutes: Number(form.duration_minutes),
slot_interval_minutes: Number(form.slot_interval_minutes),
is_active: form.is_active,
is_public: form.is_public,
visibility: form.visibility,
show_taken_slots: form.show_taken_slots,
invite_delivery: form.invite_delivery,
allow_phone_call: allowPhoneCall,
Expand Down Expand Up @@ -610,7 +611,7 @@
{/if}
<dt class="text-muted-foreground">{$t('eventTypeEditor.readOnly.labels.location')}</dt><dd>{LOCATION_TYPES.find((l) => l.value === et?.location_type)?.label ?? et.location_type}{#if et.location_value} · {et.location_value}{/if}</dd>
<dt class="text-muted-foreground">{$t('eventTypeEditor.readOnly.labels.routing')}</dt><dd class="capitalize">{et.routing_mode.replace('_', ' ')}</dd>
<dt class="text-muted-foreground">{$t('eventTypeEditor.readOnly.labels.status')}</dt><dd>{et.is_active ? $t('eventTypeEditor.readOnly.status.active') : $t('eventTypeEditor.readOnly.status.inactive')} · {et.is_public ? $t('eventTypeEditor.readOnly.status.listed') : $t('eventTypeEditor.readOnly.status.unlisted')}</dd>
<dt class="text-muted-foreground">{$t('eventTypeEditor.readOnly.labels.status')}</dt><dd>{et.is_active ? $t('eventTypeEditor.readOnly.status.active') : $t('eventTypeEditor.readOnly.status.inactive')} · {$t(`eventTypes.visibility.${et.visibility}`)}</dd>
<dt class="text-muted-foreground">{$t('eventTypeEditor.readOnly.labels.bookingPage')}</dt><dd><a href="/book/{et.slug}" target="_blank" rel="noopener" class="text-primary underline">/book/{et.slug}</a></dd>
</dl>
</div>
Expand Down Expand Up @@ -679,13 +680,7 @@
<Label for="is-active" class="cursor-pointer font-normal">{$t('eventTypeEditor.general.active')}</Label>
</div>
</div>
<div class="space-y-1.5">
<p class="text-sm font-medium">{$t('eventTypeEditor.general.visibility')}</p>
<div class="flex items-center gap-2">
<Checkbox id="is-public" bind:checked={form.is_public} />
<Label for="is-public" class="cursor-pointer font-normal">{$t('eventTypeEditor.general.public')}</Label>
</div>
</div>
<VisibilitySelect bind:value={form.visibility} />
</div>

<div class="mt-4 space-y-1.5">
Expand Down
Loading
Loading