feat(#50): document & annotation comments #57

Merged
marcel merged 10 commits from feature/50-document-comments into main 2026-03-24 12:57:53 +01:00
Owner

Closes #50

Summary

  • Backend: Flyway migration, DocumentComment entity, CommentRepository, CommentService (with flat reply-to-root resolution, authorship checks, admin override), CommentController (8 endpoints for general + annotation comments), COMMENT_NOT_FOUND error code
  • Frontend: CommentThread component (post/reply/edit/delete, relative timestamps, „bearbeitet" label), AnnotationCommentPanel (floating panel on desktop, bottom-sheet modal on mobile), annotation comment count pill (bottom-right, bold, drop shadow), auto-open panel on annotation creation, confirm dialog before deleting annotation with comments, hover effect on annotation overlays, „Diskussion" section in document detail sidebar
  • i18n: new keys in de/en/es for all comment UI strings

Test plan

  • All 156 backend unit tests pass (./mvnw test)
  • Post a general comment on a document → appears in „Diskussion" sidebar
  • Edit a comment → „bearbeitet" label appears with timestamp
  • Reply → Reply button moves to the new last comment
  • Draw a new annotation → comment panel opens automatically
  • Click a different annotation → panel switches to the correct one
  • Comment count pill shows correct count, updates after posting/deleting
  • Delete annotation with comments → confirm dialog appears; cancel aborts
  • Hover over annotation → opacity and border highlight appear
  • Mobile: annotation comment panel renders as bottom-sheet modal

🤖 Generated with Claude Code

Closes #50 ## Summary - **Backend**: Flyway migration, `DocumentComment` entity, `CommentRepository`, `CommentService` (with flat reply-to-root resolution, authorship checks, admin override), `CommentController` (8 endpoints for general + annotation comments), `COMMENT_NOT_FOUND` error code - **Frontend**: `CommentThread` component (post/reply/edit/delete, relative timestamps, „bearbeitet" label), `AnnotationCommentPanel` (floating panel on desktop, bottom-sheet modal on mobile), annotation comment count pill (bottom-right, bold, drop shadow), auto-open panel on annotation creation, confirm dialog before deleting annotation with comments, hover effect on annotation overlays, „Diskussion" section in document detail sidebar - **i18n**: new keys in de/en/es for all comment UI strings ## Test plan - [ ] All 156 backend unit tests pass (`./mvnw test`) - [ ] Post a general comment on a document → appears in „Diskussion" sidebar - [ ] Edit a comment → „bearbeitet" label appears with timestamp - [ ] Reply → Reply button moves to the new last comment - [ ] Draw a new annotation → comment panel opens automatically - [ ] Click a different annotation → panel switches to the correct one - [ ] Comment count pill shows correct count, updates after posting/deleting - [ ] Delete annotation with comments → confirm dialog appears; cancel aborts - [ ] Hover over annotation → opacity and border highlight appear - [ ] Mobile: annotation comment panel renders as bottom-sheet modal 🤖 Generated with [Claude Code](https://claude.com/claude-code)
marcel added 9 commits 2026-03-24 11:42:05 +01:00
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Auto-open AnnotationCommentPanel immediately after drawing a new annotation
- Move comment count pill to bottom-right corner (was centered at bottom)
- Increase pill size: font 11px bold, padding 2px 6px, min-width 20px, drop shadow

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Show a native confirm() dialog when the annotation has ≥1 comment,
listing the count so the user knows what will be lost.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(comments): remount AnnotationCommentPanel when switching annotations
Some checks failed
CI / Unit & Component Tests (push) Failing after 2m13s
CI / Backend Unit Tests (push) Successful in 2m23s
CI / E2E Tests (push) Failing after 24m41s
CI / Unit & Component Tests (pull_request) Failing after 2m8s
CI / Backend Unit Tests (pull_request) Successful in 2m8s
CI / E2E Tests (pull_request) Has been cancelled
fd03e56c85
Wrap the panel in {#key activeAnnotationId} so Svelte destroys and
recreates it on every annotation change, triggering onMount and
loading the correct comments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
marcel added 1 commit 2026-03-24 12:28:08 +01:00
fix(e2e): fix annotation delete test and harden comments fetch
Some checks failed
CI / E2E Tests (pull_request) Has been cancelled
CI / Unit & Component Tests (push) Successful in 2m30s
CI / Backend Unit Tests (push) Successful in 2m15s
CI / E2E Tests (push) Successful in 22m47s
CI / Unit & Component Tests (pull_request) Has been cancelled
CI / Backend Unit Tests (pull_request) Has been cancelled
34c66f80fc
- Add aria-label="Kommentare anzeigen" to annotation container div so
  getByRole('button', { name: /annotation löschen/i }) no longer
  matches the container (its name was previously inherited from the
  child delete button, causing the test to click the wrong element)
- Wrap the server-side comments fetch in a .catch and try/catch so a
  network error or non-JSON response never crashes the document load

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
marcel merged commit 34c66f80fc into main 2026-03-24 12:57:53 +01:00
marcel deleted branch feature/50-document-comments 2026-03-24 12:57:56 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: marcel/familienarchiv#57