fix(review): address review blockers from PR #475
Some checks failed
CI / Unit & Component Tests (push) Has been cancelled
CI / OCR Service Tests (push) Has been cancelled
CI / Backend Unit Tests (push) Has been cancelled
CI / Unit & Component Tests (pull_request) Failing after 3m51s
CI / OCR Service Tests (pull_request) Successful in 47s
CI / Backend Unit Tests (pull_request) Failing after 3m31s

- CommentData.java: add @Nullable on annotationId to match codebase convention
- DashboardService: isEmpty() → isBlank() for commentPreview null-guard
- ChronikRow.svelte: always set aria-label on comment rows (not only when preview present)
- ChronikRow.svelte.spec.ts: add test for aria-label on comment row without preview

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-07 19:54:56 +02:00
parent 708fd9d63e
commit 9ef3c82398
4 changed files with 19 additions and 4 deletions

View File

@@ -149,7 +149,7 @@ public class DashboardService {
UUID commentId = row.getCommentId();
CommentData commentData = commentId != null ? commentDataByComment.get(commentId) : null;
UUID annotationId = commentData != null ? commentData.annotationId() : null;
String commentPreview = commentData != null && !commentData.preview().isEmpty()
String commentPreview = commentData != null && !commentData.preview().isBlank()
? commentData.preview() : null;
return new ActivityFeedItemDTO(
org.raddatz.familienarchiv.audit.AuditKind.valueOf(row.getKind()),

View File

@@ -1,5 +1,6 @@
package org.raddatz.familienarchiv.document.comment;
import jakarta.annotation.Nullable;
import java.util.UUID;
public record CommentData(UUID annotationId, String preview) {}
public record CommentData(@Nullable UUID annotationId, String preview) {}

View File

@@ -108,8 +108,10 @@ const rowHref: string = $derived(
<a
href={rowHref}
data-variant={variant}
aria-label={variant === 'comment' && item.commentPreview
? `${m.chronik_comment_added({ actor: actorName, doc: docTitle })} ${item.commentPreview}`
aria-label={variant === 'comment'
? item.commentPreview
? `${m.chronik_comment_added({ actor: actorName, doc: docTitle })} ${item.commentPreview}`
: m.chronik_comment_added({ actor: actorName, doc: docTitle })
: undefined}
class="group flex items-start gap-3 p-3 transition-colors hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:outline-none
{variant === 'for-you' ? 'border-l-[3px] border-accent bg-accent-bg/10' : ''}"

View File

@@ -229,6 +229,18 @@ describe('ChronikRow', () => {
expect(link?.getAttribute('aria-label')).toContain('A wonderful letter from grandma');
});
it('link still has aria-label for comment variant when commentPreview is absent', async () => {
const item: ActivityFeedItemDTO = {
...baseItem,
kind: 'COMMENT_ADDED',
commentPreview: undefined
};
render(ChronikRow, { item });
const link = document.querySelector('a[aria-label]');
expect(link).not.toBeNull();
expect(link?.getAttribute('aria-label')).not.toBeNull();
});
// --- robustness: title rendering for edge cases ---
it('still renders the row link when documentTitle is an empty string', async () => {
// Felix: verbText.indexOf(docTitle) returned 0 for empty titles — the span