feat(chronik-fuer-dich): include annotationId in mention deep-link

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) <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-21 17:21:16 +02:00
parent 7c22e42b8f
commit 95c11b9b46
2 changed files with 21 additions and 1 deletions

View File

@@ -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);
}
</script>

View File

@@ -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 <a>', async () => {
render(ChronikFuerDichBox, {
unread: [notif({ id: 'x' })],