From 95c11b9b46c1b333801a173e4bd46a32a585bc95 Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 21 Apr 2026 17:21:16 +0200 Subject: [PATCH] feat(chronik-fuer-dich): include annotationId in mention deep-link MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sidebar was constructing /documents/:id?commentId=… without the annotationId, so clicking a mention there no-op'ed the deep-link scroll helper. Route the href through buildCommentHref so the bell and the chronik sidebar produce identical URLs. Refs #300. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../chronik/ChronikFuerDichBox.svelte | 3 ++- .../chronik/ChronikFuerDichBox.svelte.spec.ts | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/components/chronik/ChronikFuerDichBox.svelte b/frontend/src/lib/components/chronik/ChronikFuerDichBox.svelte index fd4b94f9..82f9a6e6 100644 --- a/frontend/src/lib/components/chronik/ChronikFuerDichBox.svelte +++ b/frontend/src/lib/components/chronik/ChronikFuerDichBox.svelte @@ -2,6 +2,7 @@ import * as m from '$lib/paraglide/messages.js'; import { relativeTime } from '$lib/utils/time'; import type { NotificationItem } from '$lib/stores/notifications.svelte'; +import { buildCommentHref } from '$lib/utils/commentDeepLink'; interface Props { unread: NotificationItem[]; @@ -18,7 +19,7 @@ function verb(type: NotificationItem['type'], actor: string): string { } function href(n: NotificationItem): string { - return `/documents/${n.documentId}?commentId=${n.referenceId}`; + return buildCommentHref(n.documentId, n.referenceId, n.annotationId); } diff --git a/frontend/src/lib/components/chronik/ChronikFuerDichBox.svelte.spec.ts b/frontend/src/lib/components/chronik/ChronikFuerDichBox.svelte.spec.ts index edb53951..3bea1aae 100644 --- a/frontend/src/lib/components/chronik/ChronikFuerDichBox.svelte.spec.ts +++ b/frontend/src/lib/components/chronik/ChronikFuerDichBox.svelte.spec.ts @@ -114,6 +114,25 @@ describe('ChronikFuerDichBox', () => { expect(onMarkRead.mock.calls[0][0]).toEqual(n); }); + it('mention row href includes both commentId and annotationId when annotationId is present', async () => { + render(ChronikFuerDichBox, { + unread: [ + notif({ + id: 'n-link', + documentId: 'doc-42', + referenceId: 'comment-7', + annotationId: 'annot-9' + }) + ], + onMarkRead: vi.fn(), + onMarkAllRead: vi.fn() + }); + const link = document.querySelector( + 'a[href="/documents/doc-42?commentId=comment-7&annotationId=annot-9"]' + ); + expect(link).not.toBeNull(); + }); + it('Dismiss button is a sibling of the document link, never nested inside ', async () => { render(ChronikFuerDichBox, { unread: [notif({ id: 'x' })],