Privacy notice: built-in text up to date, review flow, acceptance (1.48.1)

The built-in notice now covers volunteer rosters, event series, season
passes, webhooks, how people agree to it, and the provider-notices
storage item. Sites with their own published version see what changed
in the editor (sections marked, use new text per section or all, add
missing sections, "Done - hide this"). Account activation asks for
agreement to the terms and notice; anyone who never accepted is asked
once after login. The cookie button shows above any cookie section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-28 13:15:57 +02:00
co-authored by Claude Opus 5.5
parent aa79168660
commit adb6e11000
27 changed files with 368 additions and 44 deletions
+47 -1
View File
@@ -11,7 +11,7 @@ test.describe("privacy notice, operators and access log (POPIA)", () => {
// A version that needs accepting is published below; accept it for every seeded account
// afterwards so later test files don't meet the prompt.
test.afterAll(async ({ request }) => {
const tokens = [...(["admin", "supervisor", "staff", "user"] as Role[]).map(r => seed().users[r].token), seed().newsPromptUser.token];
const tokens = [...(["admin", "supervisor", "staff", "user"] as Role[]).map(r => seed().users[r].token), seed().newsPromptUser.token, seed().noticeFirstUser.token];
for (const token of tokens) {
await request.post(`${API}/api/privacy/me/notice/accept`, { headers: { Authorization: `Bearer ${token}` } });
}
@@ -55,6 +55,52 @@ test.describe("privacy notice, operators and access log (POPIA)", () => {
await api(page, "admin", "DELETE", `/api/privacy/operators/${op.id}`);
});
test("after publishing its own version, the editor points out new built-in text", async ({ page }) => {
// The published version came from the built-in text; put an older wording back in one changed
// section so it shows as having new text.
const draft = await api<Draft>(page, "admin", "GET", "/api/privacy/notice/draft");
const sections = draft.sections.map(s => (s.id === "changes" ? { ...s, body: "We may update this notice from time to time." } : s));
await api(page, "admin", "PUT", "/api/privacy/notice/draft", { sections });
await loginAs(page, "admin");
await page.goto("/dashboard/admin/privacy?tab=notice");
const banner = page.getByTestId("builtin-updates");
await expect(banner).toContainText("The built-in privacy notice has been updated");
await expect(banner).toContainText("How people agree to the notice");
const marked = page.getByTestId("section-has-new-text");
await expect(marked).toHaveCount(1);
await marked.getByText("New built-in text for this section — show it").click();
await marked.getByRole("button", { name: "Use the new text" }).click();
await expect(page.getByTestId("section-has-new-text")).toHaveCount(0);
await page.getByRole("button", { name: "Save draft" }).click();
await expect(page.getByText("Draft saved.")).toBeVisible();
await banner.getByRole("button", { name: "Done — hide this" }).click();
await expect(page.getByTestId("builtin-updates")).toHaveCount(0);
await page.reload();
await expect(page.getByLabel("1. Introduction text")).toBeVisible();
await expect(page.getByTestId("builtin-updates")).toHaveCount(0);
await api(page, "admin", "DELETE", "/api/privacy/notice/draft");
});
test("someone who never accepted the notice is asked once, after login", async ({ page }) => {
await page.addInitScript(token => localStorage.setItem("hope_events_token", token), seed().noticeFirstUser.token);
await page.goto("/dashboard/user");
const dialog = page.getByRole("dialog", { name: "Our privacy notice" });
await expect(dialog).toBeVisible();
await expect(dialog).toContainText("It explains what we keep about you");
await dialog.getByRole("button", { name: "I accept" }).click();
await expect(dialog).toBeHidden();
await page.reload();
await expect(page.getByText("My Events").first()).toBeVisible();
await expect(page.getByRole("dialog", { name: "Our privacy notice" })).toHaveCount(0);
});
test("the cookie button stays on a published notice", async ({ page }) => {
await page.goto("/legal/privacy");
await expect(page.getByRole("button", { name: "Change my cookie choice" })).toBeVisible();
});
test("a significant change is accepted once, after login", async ({ page }) => {
const draft = await api<Draft>(page, "admin", "GET", "/api/privacy/notice/draft");
// Re-acceptance needs a summary of what changed.