feat(chronik): deep-link mentions and comments to the specific comment #301

Merged
marcel merged 11 commits from feat/issue-300-chronik-mention-deep-link into main 2026-04-21 19:06:19 +02:00
2 changed files with 21 additions and 1 deletions
Showing only changes of commit 95c11b9b46 - Show all commits

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' })],