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 f1714f9286
commit 5dea712b72
27 changed files with 368 additions and 44 deletions
+39 -5
View File
@@ -60,18 +60,23 @@ describe('cleanSections', () => {
});
describe('noticePromptPending', () => {
test('nobody is asked while no version needs re-acceptance', async () => {
test('someone who never accepted any version is asked once (first)', async () => {
prisma.privacyNotice.findFirst.mockResolvedValue(null);
expect(await notice.noticePromptPending({ noticeVersionAccepted: null })).toBe(false);
expect(await notice.noticePromptPending({ noticeVersionAccepted: null })).toBe('first');
});
test('nobody else is asked while no version needs re-acceptance', async () => {
prisma.privacyNotice.findFirst.mockResolvedValue(null);
expect(await notice.noticePromptPending({ noticeVersionAccepted: 0 })).toBe(false);
});
test('asked when they accepted an older version than the newest one that needs it', async () => {
prisma.privacyNotice.findFirst.mockResolvedValue({ version: 3 });
expect(await notice.noticePromptPending({ noticeVersionAccepted: 2 })).toBe(true);
expect(await notice.noticePromptPending({ noticeVersionAccepted: null })).toBe(true);
expect(await notice.noticePromptPending({ noticeVersionAccepted: 2 })).toBe('updated');
expect(await notice.noticePromptPending({ noticeVersionAccepted: 0 })).toBe('updated');
expect(await notice.noticePromptPending({ noticeVersionAccepted: 3 })).toBe(false);
expect(await notice.noticePromptPending({ noticeVersionAccepted: 5 })).toBe(false);
expect(prisma.privacyNotice.findFirst.mock.calls[0][0].where).toEqual({ requiresAcceptance: true });
expect(prisma.privacyNotice.findFirst.mock.calls.at(-1)[0].where).toEqual({ requiresAcceptance: true });
});
});
@@ -107,3 +112,32 @@ describe('reportRowCount', () => {
expect(reportRowCount(null)).toBe(0);
});
});
describe('changes to the built-in text', () => {
test('a site that never published shows the built-in text, so there is nothing to review', async () => {
prisma.privacyNotice.findFirst.mockResolvedValue(null);
expect(await notice.builtInUpdates()).toEqual([]);
});
test('a site with its own version is shown the changes it has not reviewed', async () => {
prisma.privacyNotice.findFirst.mockResolvedValue({ version: 2 });
prisma.appSetting.findUnique.mockResolvedValue(null);
expect((await notice.builtInUpdates()).map(u => u.revision)).toContain('1.48.1');
prisma.appSetting.findUnique.mockResolvedValue({ value: notice.BUILT_IN_REVISION });
expect(await notice.builtInUpdates()).toEqual([]);
});
test('every changed section exists in the built-in text', () => {
const ids = notice.defaultSections().map(s => s.id);
for (const u of notice.BUILT_IN_UPDATES) for (const id of u.sections) expect(ids).toContain(id);
expect(notice.revisionLess('1.47.9', '1.48.1')).toBe(true);
expect(notice.revisionLess('1.48.10', '1.48.9')).toBe(false);
});
test('the built-in text covers the features since 1.46', () => {
const all = notice.defaultSections().map(s => s.body).join('\n');
for (const words of ['volunteer', 'series you follow', 'season pass', 'webhook', 'cross_events_dismissed_notices', 'activate an account']) {
expect([words, all.toLowerCase().includes(words.toLowerCase())]).toEqual([words, true]);
}
});
});