Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
18bee0a
Add the translator and English catalog that localization builds on
claude Nov 13, 2026
d5f43d9
Keep the message catalogs out of client files with a lint rule
claude Nov 13, 2026
287efb2
Merge branch 'main' into claude/issue-620-client-lint
richshaw Nov 13, 2026
1930b8a
Check the message catalogs in pnpm test
claude Nov 13, 2026
28a7b8b
Merge claude/issue-620-client-lint, which now has main with #889
claude Nov 13, 2026
a4559c0
Lint hard-coded text where it has moved to the catalogs
claude Nov 13, 2026
218b7d9
Merge branch 'main' into claude/issue-623-catalog-check
richshaw Nov 13, 2026
a7a10ed
Catch a select shown as a plain placeholder in the catalog check
claude Nov 13, 2026
4480055
Precompile the message catalogs at build time
claude Nov 13, 2026
701bd61
Merge branch 'claude/issue-623-catalog-check' into claude/issue-623-t…
claude Nov 14, 2026
dd50e3b
Merge branch 'main' into claude/issue-623-text-lint
richshaw Nov 14, 2026
20409b8
Give slot dates and times a language
claude Nov 14, 2026
18564d2
Escape backslashes too in filesAt's globs
claude Nov 14, 2026
9ca3cb6
Merge branch 'claude/issue-623-text-lint' into claude/issue-624-preco…
claude Nov 14, 2026
86a0365
Merge branch 'claude/issue-624-precompile' into claude/issue-622-slot…
claude Nov 14, 2026
1559802
Merge branch 'main' into claude/issue-624-precompile
claude Nov 14, 2026
ee870e1
Merge branch 'claude/issue-624-precompile' into claude/issue-622-slot…
claude Nov 14, 2026
325f17a
Merge branch 'main' into claude/issue-622-slot-format
richshaw Nov 14, 2026
d768b87
Give the other formatters a language
claude Nov 14, 2026
3c9b122
Merge branch 'claude/issue-622-slot-format' into claude/issue-622-oth…
claude Nov 14, 2026
40bb396
Give a signup a language and an instance a default one, with no visib…
claude Nov 14, 2026
07afbfd
Add a Signup language control to the Settings tab, hidden while one l…
claude Nov 14, 2026
a5d1fab
Keep the language rules out of the browser's view, so no page grows
claude Nov 14, 2026
efff208
Read any stored signup language leniently, and check the one sent as …
claude Nov 14, 2026
d53625b
Say plainly that DEFAULT_LOCALE accepts only en today
claude Nov 14, 2026
49db138
Keep the Signup language form in the Settings page's own file
claude Nov 14, 2026
a7f3825
Merge branch 'main' into claude/issue-625-signup-locale
claude Nov 14, 2026
f9e4103
Merge branch 'claude/issue-625-signup-locale' into claude/issue-625-s…
claude Nov 14, 2026
fe68bb1
Work out an organizer's language as pure logic, with no storage yet
claude Nov 14, 2026
bd3c442
Read a public signup's row once per request, through a cached loader
claude Nov 14, 2026
5ddc90f
Carry the organizer's saved language in the session and the token con…
claude Nov 14, 2026
afaf7be
Let an organizer save a language for new signups, hidden until a seco…
claude Nov 14, 2026
eaa788a
Merge main into claude/issue-625-signup-locale
claude Nov 15, 2026
3d90da2
Merge #897's final head into claude/issue-625-settings-control
claude Nov 15, 2026
271a335
Merge main: #897 landed as c1f13bd, same tree as its head
claude Nov 15, 2026
0f5ae9d
Merge #899's final head into claude/issue-626-organizer-locale-core
claude Nov 15, 2026
e4c7170
Merge main: #899 landed as 1d2a721, same tree as its head
claude Nov 15, 2026
2074a5f
Merge #901's final head into claude/issue-628-signup-row-loader
claude Nov 15, 2026
f1e9bb4
Merge main: #901 landed as c2fb12a, same tree as its head
claude Nov 15, 2026
47ec19d
Merge #902's final head into claude/issue-626-organizer-locale-column
claude Nov 15, 2026
d348453
Merge main: #902 landed as 9f39d58, same tree as its head
claude Nov 15, 2026
4ccf859
Merge #903's final head into claude/issue-626-account-language
claude Nov 16, 2026
4dbb0cc
Merge main: #903 landed as f8dabd9, same tree as its head
claude Nov 16, 2026
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to OpenSignup are documented here. Format follows [Keep a Ch

- `DEFAULT_LOCALE`, an optional setting for the instance's language (#625), for an instance that serves one language community. Today it accepts only `en`, which changes nothing, since English is the only language shipped so far. Any other value, a language that hasn't shipped yet included, stops the app like any other bad setting: the reminder worker exits at startup, and every page that needs the database fails, both with an "Invalid environment" error. Other languages become valid as they ship. Once one has, every signup without a language of its own will follow the setting (today that is every signup), and left unset, each organizer's own language will apply. It's read when the app starts, not built in: "Branding your instance" in the README says where it goes on each platform. Signups can now hold a language too, in `settings.locale`: `POST /api/signups` and `PATCH /api/signups/[id]` take one that has shipped to participants (only `en` so far), refuse any other with `invalid_input` on `settings.locale`, and clear it on `null`. A language stored earlier that has since stopped shipping doesn't stop other changes to the signup. Pages and emails don't follow it yet, and the AI connector's tools neither take nor show it.
- A place for each organizer's own language (#626): migration `0015` adds `organizers.locale`, an empty, nullable text column. Nothing sets it yet, and nothing anyone sees follows it. It's read with the rest of the organizer's account, on each of their pages and each request from their AI assistant, in the query that already ran there, so neither sends another statement to the database. A stored value is passed along as it is, so one that names no language can't stop anyone signing in.
- The privacy page now lists, among what an organizer's account holds, the language they choose for their new signups (#626). Account Settings has a "Language for new signups" choice for it, which appears only once a second language has shipped to participants and offers only those, so it isn't there yet. New signups don't follow it yet either.
- An organizer who opens their own signup's public link now sees a strip across the top of the page (#647), styled like the organizer app's header and above the brand mark, outside the page's content: "**Your signup.** Only organizers see this bar.", with **See responses** and **Edit signup**, which go to the signup's Responses and Build tabs. Screen readers meet it as an "Organizer" navigation landmark. It shows on an open or closed signup to any member of the signup's workspace, viewers included, who is signed in on that browser. Participants see no change, and neither does an organizer from another workspace. The page now reads the organizer's session; a visitor with no session cookie still costs it nothing, since Auth.js answers without the database, and a signed-in organizer's visit sends two more statements (the session and their workspaces), which `budgets.json` pins as its own case.
- `pnpm oauth:keys rotate` and `pnpm oauth:keys retire <kid>` rotate the key that signs connected AI assistants' access tokens (#564). `rotate` adds a key and lists the active ones; after it, restart every web instance and wait 16 minutes. `retire` refuses an unknown key, and refuses an old key until a newer one has been signing for an access token's lifetime plus the verifier's 15 seconds of clock tolerance, which catches a forgotten restart; it can only see that one instance moved to the new key, so with several instances every one still has to be restarted first. `retire --force <kid>` retires a leaked key at once, at the cost of one refresh for each connected assistant, and still refuses the newest key. Each instance now records when it starts signing with a key (a new `signing_since` column on `oauth_signing_keys`, added by migration `0013`), and re-reads its signing keys from the table every 5 minutes, in the background, as well as on an unknown key, so a retired key stops being trusted without a restart; if that re-read fails, it keeps verifying with the keys it holds. Requests that need the keys at the same time share one read. Neither the CLI nor the server log prints a failed key query's parameters, which for a new key include its private half. The steps are in `docs/connect-ai-assistant.md`. In the Docker setup, run it as `docker compose exec web pnpm oauth:keys …`.
- Magic Compose asks a few questions when a description doesn't say what people sign up for (#570). A description that is only an event's name, like "Bake sale", used to get three "TBD" rows or made-up jobs. Now the AI answers with the topics the description leaves out (what, when, how many) and two to four suggestions for what people could sign up for, in the description's language; it never suggests dates or counts, which the page asks for with its own controls. The organizer's answers go back with the description, and that second call always drafts or refuses, with "TBD:" rows for anything left blank and for **Draft with placeholders**. A description that says what but not when or how many still drafts straight away, with "TBD:" rows where the slots need dates or times, and a list of items, roles or tasks, or a schedule of dated practices or shifts, counts as saying what. A first reply with questions the page can't show (no "what", or one usable option) is tried once more on the same quota, and extra options are cut to four. A slot gets no limit only when the description or the answers say there's none. Both calls count toward the hour's AI drafts, so the limit goes from 10 to 12 an hour. The privacy page now says the answers go to the AI provider along with the description. `pnpm eval:magic-compose` scores questions: a case can expect them (`questions.*` checks), or give `answers` to send after a first call that must ask, and the draft made from them is scored. `ev_008`, the vague team prompt, now expects questions instead of 1-6 placeholder slots (and is about a swim club, not the soccer team of the prompt's own example, so it scores the rule rather than recall), and ten new made-up cases cover prompts that must ask, near misses that must still draft, and drafts from answers. `pnpm eval:mcp` passes an assistant that asks the organizer on those cases and skips the ones with answers.
Expand Down
6 changes: 5 additions & 1 deletion src/app/(legal)/privacy/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function PrivacyPage() {
<>
<header className="space-y-2">
<h1 className="text-3xl font-semibold tracking-tight">Privacy policy</h1>
<p className="text-sm text-ink-muted">Last updated: 31 October 2026</p>
<p className="text-sm text-ink-muted">Last updated: 14 November 2026</p>
</header>

<section className="space-y-3">
Expand Down Expand Up @@ -87,6 +87,10 @@ export default function PrivacyPage() {
<ul className="list-disc space-y-1 pl-6">
<li>Email address (used to send magic-link sign-in emails).</li>
<li>Optional display name and organization name.</li>
<li>
The language you choose for your new signups, if you choose one in your account&apos;s
Settings.
</li>
<li>
If your account was created by signing in with a third-party provider such as Google,
the web address of the profile picture that provider returned.
Expand Down
134 changes: 134 additions & 0 deletions src/app/app/(chrome)/settings/actions.db.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import { eq, inArray } from 'drizzle-orm';
import { getDb } from '@/db/client';
import { organizers } from '@/db/schema/organizers';
import { type Audience, SHIPPED } from '@/i18n/config';
import { makeId } from '@/lib/ids';
import type { Actor } from '@/lib/policy';
import { setOrganizerLocaleAction } from './actions';

// The action reads the organizer from the session cookie. Tests hand it one
// directly instead of going through Auth.js.
const session = vi.hoisted(() => ({ actor: { kind: 'anonymous' } as Actor }));
vi.mock('@/auth/session', () => ({
requireOrganizerSession: async () => ({}),
toActor: () => session.actor,
}));

// Next's redirect() throws to end the action; this one throws the address.
class Redirected extends Error {
constructor(readonly url: string) {
super(`redirect to ${url}`);
}
}
vi.mock('next/navigation', () => ({
redirect: (url: string) => {
throw new Redirected(url);
},
}));
const revalidatePath = vi.hoisted(() => vi.fn());
vi.mock('next/cache', () => ({ revalidatePath }));

// Only English has shipped today; one test ships Swedish by changing the list.
const asShippedToday = { ...SHIPPED };
function ship(audience: Audience, locales: string[]) {
(SHIPPED as Record<Audience, readonly string[]>)[audience] = locales;
}

/** Sends the form as the page does, with `fields` in it, and says where the action went. */
async function submit(fields: Record<string, string>): Promise<string> {
const form = new FormData();
for (const [name, value] of Object.entries(fields)) form.set(name, value);
try {
await setOrganizerLocaleAction(form);
} catch (e) {
if (e instanceof Redirected) return e.url;
throw e;
}
throw new Error('the action did not redirect');
}

const SAVED = '/app/settings?saved=language';
const REFUSED = '/app/settings?error=invalid_input';

describe('setOrganizerLocaleAction (db)', () => {
const db = getDb();
const mine = makeId('org');
const theirs = makeId('org');
const organizer = (id: string): Actor => ({
kind: 'organizer',
id,
email: `${id.toLowerCase()}@example.com`,
workspaceIds: [],
workspaceRoles: {},
});
const stored = async (id: string) => {
const [row] = await db
.select({ locale: organizers.locale })
.from(organizers)
.where(eq(organizers.id, id));
return row?.locale;
};

beforeAll(async () => {
await db.insert(organizers).values([
{ id: mine, email: `${mine.toLowerCase()}@example.com` },
{ id: theirs, email: `${theirs.toLowerCase()}@example.com` },
]);
});

afterAll(async () => {
await db.delete(organizers).where(inArray(organizers.id, [mine, theirs]));
});

beforeEach(() => {
revalidatePath.mockClear();
session.actor = organizer(mine);
});

afterEach(async () => {
Object.assign(SHIPPED, asShippedToday);
await db
.update(organizers)
.set({ locale: null })
.where(inArray(organizers.id, [mine, theirs]));
});

it('saves a shipped language on the signed-in organizer and comes back saying so', async () => {
expect(await submit({ locale: 'en' })).toBe(SAVED);
expect(await stored(mine)).toBe('en');
expect(revalidatePath).toHaveBeenCalledWith('/app/settings');

ship('participant', ['en', 'sv']);
expect(await submit({ locale: 'sv' })).toBe(SAVED);
expect(await stored(mine)).toBe('sv');
});

it('saves on the signed-in organizer only, whoever the form names', async () => {
await db.update(organizers).set({ locale: 'en' }).where(eq(organizers.id, theirs));
ship('participant', ['en', 'sv']);

expect(await submit({ locale: 'sv', organizerId: theirs, id: theirs, organizer: theirs })).toBe(
SAVED,
);
expect(await stored(mine)).toBe('sv');
expect(await stored(theirs)).toBe('en');
});

it('refuses a language that hasn’t shipped, an empty one or none, and keeps the stored one', async () => {
await submit({ locale: 'en' });
revalidatePath.mockClear();

const forms: Record<string, string>[] = [
{ locale: 'sv' },
{ locale: 'xx' },
{ locale: '' },
{},
];
for (const fields of forms) {
expect(await submit(fields)).toBe(REFUSED);
}
expect(await stored(mine)).toBe('en');
expect(revalidatePath).not.toHaveBeenCalled();
});
});
28 changes: 28 additions & 0 deletions src/app/app/(chrome)/settings/actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'use server';

import { revalidatePath } from 'next/cache';
import { redirect } from 'next/navigation';
import { requireOrganizerSession, toActor } from '@/auth/session';
import { getDb } from '@/db/client';
import { refusalAsResult } from '@/lib/errors';
import { updateOrganizerLocale } from '@/services/organizers';

const SETTINGS_PATH = '/app/settings';

/**
* Account Settings' "Language for new signups", there once a second language
* has shipped to participants. Saves the signed-in organizer's own language:
* the form names no organizer, so it can't change anyone else's. The service
* refuses a language that hasn't shipped, and a form with no choice in it, and
* the page shows the refusal by its code. Either way it comes back to Account
* Settings, with `saved=language` when it saved.
*/
export async function setOrganizerLocaleAction(formData: FormData) {
const session = await requireOrganizerSession();
const result = await refusalAsResult(() =>
updateOrganizerLocale(getDb(), toActor(session), formData.get('locale')),
);
if (!result.ok) redirect(`${SETTINGS_PATH}?error=${result.error.code}`);
revalidatePath(SETTINGS_PATH);
redirect(`${SETTINGS_PATH}?saved=language`);
}
132 changes: 132 additions & 0 deletions src/app/app/(chrome)/settings/page.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
// @vitest-environment jsdom

import '@testing-library/jest-dom/vitest';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { cleanup, render, screen, within } from '@testing-library/react';
import { type Audience, type CatalogLocale, SHIPPED } from '@/i18n/config';

// Only English has shipped to participants today. The tests that need a
// choice ship Swedish by changing the list itself, so the page and
// `chooseOrganizerLocale` both see it.
const asShippedToday = { ...SHIPPED };
function ship(audience: Audience, locales: string[]) {
(SHIPPED as Record<Audience, readonly string[]>)[audience] = locales;
}

// What the page reads around the form: the instance's language (none, unless
// a test sets one), the browser's Accept-Language, and the session.
const request = vi.hoisted(() => ({
instanceDefault: undefined as string | undefined,
acceptLanguage: null as string | null,
saved: null as string | null,
}));
vi.mock('@/i18n/server', () => ({ instanceDefaultLocale: () => request.instanceDefault }));
vi.mock('next/headers', () => ({
headers: async () =>
new Headers(
request.acceptLanguage === null ? {} : { 'accept-language': request.acceptLanguage },
),
}));
vi.mock('@/auth/session', () => ({
requireOrganizerSession: async () => ({ email: 'pat@example.com', locale: request.saved }),
}));
// The server action needs a database.
vi.mock('./actions', () => ({ setOrganizerLocaleAction: vi.fn() }));

const { default: SettingsPage } = await import('./page');

async function renderPage(searchParams: { error?: string; saved?: string } = {}) {
return render(await SettingsPage({ searchParams: Promise.resolve(searchParams) }));
}

const languageGroup = () => screen.queryByRole('group', { name: 'Language for new signups' });
const checked = () =>
screen.getAllByRole('radio').filter((radio) => (radio as HTMLInputElement).checked);

afterEach(() => {
cleanup();
Object.assign(SHIPPED, asShippedToday);
Object.assign(request, { instanceDefault: undefined, acceptLanguage: null, saved: null });
});

describe('Account Settings: Language for new signups', () => {
it('isn’t there while one language has shipped to participants', async () => {
request.saved = 'en';
await renderPage({ saved: 'language' });
expect(screen.getByRole('heading', { level: 1, name: 'Settings' })).toBeInTheDocument();
expect(screen.getByRole('link', { name: /Connected apps/ })).toBeInTheDocument();
expect(languageGroup()).not.toBeInTheDocument();
expect(screen.queryByRole('radio')).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: 'Save' })).not.toBeInTheDocument();
expect(screen.queryByRole('status')).not.toBeInTheDocument();
});

it('offers each shipped language by its own name once there are two, with the saved one chosen', async () => {
ship('participant', ['en', 'sv']);
request.saved = 'sv';
request.acceptLanguage = 'en';
await renderPage();

const group = within(languageGroup()!);
const english = group.getByRole('radio', { name: 'English' });
const swedish = group.getByRole('radio', { name: 'Svenska' });
expect(english).toHaveAttribute('name', 'locale');
expect(english).toHaveAttribute('value', 'en');
expect(swedish).toHaveAttribute('value', 'sv');
// Each name is marked as its own language, for screen readers.
expect(group.getByText('Svenska')).toHaveAttribute('lang', 'sv');
expect(checked()).toEqual([swedish]);
expect(screen.getByRole('button', { name: 'Save' })).toBeInTheDocument();
expect(screen.queryByRole('status')).not.toBeInTheDocument();
expect(screen.queryByRole('alert')).not.toBeInTheDocument();
});

it('with nothing saved, shows the language new signups would get', async () => {
ship('participant', ['en', 'sv']);
const shown = async () => {
await renderPage();
const [radio] = checked();
cleanup();
return radio?.getAttribute('value') as CatalogLocale;
};

// The browser's top language, when it has shipped.
request.acceptLanguage = 'sv-SE,en;q=0.8';
expect(await shown()).toBe('sv');
// The instance's language comes before the browser.
request.instanceDefault = 'en';
expect(await shown()).toBe('en');
// A saved language that has left the list counts as none.
request.instanceDefault = undefined;
request.saved = 'xx';
expect(await shown()).toBe('sv');
// English when nothing else applies.
request.acceptLanguage = null;
expect(await shown()).toBe('en');
});

it('says Saved after a save, and nothing for any other value', async () => {
ship('participant', ['en', 'sv']);
await renderPage({ saved: 'language' });
expect(within(languageGroup()!.closest('form')!).getByRole('status')).toHaveTextContent(
'Saved',
);
cleanup();

await renderPage({ saved: '1' });
expect(screen.queryByRole('status')).not.toBeInTheDocument();
});

it('shows a refusal in the Settings tab’s words, and only for a code the action sends', async () => {
ship('participant', ['en', 'sv']);
await renderPage({ error: 'invalid_input' });
expect(screen.getByRole('alert')).toHaveTextContent('Some values weren’t accepted.');
cleanup();

for (const error of ['Your account is locked. Email us at once.', 'toString', '']) {
await renderPage({ error });
expect(screen.queryByRole('alert')).not.toBeInTheDocument();
cleanup();
}
});
});
Loading
Loading