From 4944918692976f33cbfe0376815755ca0e86c210 Mon Sep 17 00:00:00 2001 From: Marcel Date: Mon, 1 Jun 2026 20:06:12 +0200 Subject: [PATCH] feat(document): remove the visible Originaltext line from DocumentDate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DocumentDate rendered an "Originaltext: " secondary line for UNKNOWN/SEASON/APPROX dates, gated by a showRaw prop. Drop the visible line, the showRaw prop, the showRawLine derived, and the now-unused date_original_label message import. The raw prop stays — it still feeds the SEASON word in formatDocumentDate, which only ever maps a fixed German season token (never emits raw text), so no XSS surface remains. Update both DocumentRow call sites to drop the now-gone showRaw={false} and the comment that justified it. Remove the two DocumentDate tests that asserted on the deleted DOM sink (the UNKNOWN secondary line and its XSS-escaping); the DAY/MONTH coverage stays. Co-Authored-By: Claude Opus 4.8 --- frontend/src/lib/document/DocumentDate.svelte | 20 ++----------------- .../lib/document/DocumentDate.svelte.test.ts | 15 -------------- frontend/src/lib/document/DocumentRow.svelte | 6 ------ 3 files changed, 2 insertions(+), 39 deletions(-) diff --git a/frontend/src/lib/document/DocumentDate.svelte b/frontend/src/lib/document/DocumentDate.svelte index 5b959881..8b06dbd4 100644 --- a/frontend/src/lib/document/DocumentDate.svelte +++ b/frontend/src/lib/document/DocumentDate.svelte @@ -1,30 +1,20 @@ @@ -61,10 +51,4 @@ const showRawLine = $derived( {:else} {label} {/if} - {#if showRawLine} - - {m.date_original_label()} {raw} - {/if} diff --git a/frontend/src/lib/document/DocumentDate.svelte.test.ts b/frontend/src/lib/document/DocumentDate.svelte.test.ts index fa842b7b..af0b8842 100644 --- a/frontend/src/lib/document/DocumentDate.svelte.test.ts +++ b/frontend/src/lib/document/DocumentDate.svelte.test.ts @@ -17,19 +17,4 @@ describe('DocumentDate', () => { render(DocumentDate, { props: { iso: '1916-06-01', precision: 'MONTH', raw: 'Juni 1916' } }); await expect.element(page.getByText('Juni 1916')).toBeInTheDocument(); }); - - it('shows the verbatim raw cell as a visible secondary line for UNKNOWN (not tooltip-only)', async () => { - render(DocumentDate, { props: { iso: null, precision: 'UNKNOWN', raw: 'Sommer?' } }); - // Real, visible text — not hidden behind a title attribute. - await expect.element(page.getByText('Datum unbekannt')).toBeInTheDocument(); - await expect.element(page.getByText(/Sommer\?/)).toBeVisible(); - }); - - it('renders a malicious raw value as inert escaped text (no element injected)', async () => { - const malicious = ''; - render(DocumentDate, { props: { iso: null, precision: 'UNKNOWN', raw: malicious } }); - // The payload appears as literal text, and no is created in the DOM. - await expect.element(page.getByText(/
-
@@ -194,7 +189,6 @@ function safeTagColor(color: string | null | undefined): string { iso={doc.documentDate} precision={doc.metaDatePrecision} end={doc.metaDateEnd} - showRaw={false} />