Skip to content

Add "My comments and replies" overview page - #1645

Draft
frankdekker with Copilot wants to merge 3 commits into
masterfrom
copilot/add-show-my-comments-page-again
Draft

frankdekker with Copilot wants to merge 3 commits into
masterfrom
copilot/add-show-my-comments-page-again

Conversation

Copilot AI commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Adds a page that lists the comments and replies placed by the logged-in user. It opens from a new chat icon (bi-chat-left-text) in the header, placed between Notifications and Logout.

The page is at GET /app/comments (ROLE_USER):

  • Order: newest first by default; a toggle switches to last updated.
  • Search: filters on the item's own message text.
  • Paging: 30 items per page.
  • Replies: each reply is shown under the comment it answers.
  • Links: each item links to the review and to the file location (#focus:comment:ID / #focus:reply:ID).

Query (CommentRepository)

  • Comments and replies are combined into one sorted, paginated list in SQL, using a DBAL UNION ALL of (type, id, create_timestamp, update_timestamp). DQL has no UNION.
    • The page of ids is then loaded with two join-fetching DQL queries, so rendering does not trigger extra queries.
    • Results keep the union's row order.
  • Visibility follows CommentReplyVisibilityExtension: a reply is included only if its parent comment is final or belongs to the user. The user's replies on other users' drafts are therefore hidden.
  • The sort column is whitelisted. Ties are broken by id DESC, type ASC.
  • Search is a bound parameter, with % and _ escaped via escapeStringForLike and ESCAPE '!'.
  • The count wraps the same union: SELECT COUNT(*) FROM (<union>) AS items.
$query->union($comments)->addUnion($replies, UnionType::ALL)
    ->orderBy($orderColumn, 'DESC')->addOrderBy('id', 'DESC')->addOrderBy('type', 'ASC')
    ->setFirstResult(($page - 1) * $perPage)->setMaxResults($perPage);

Request, view models, template

  • UserCommentsRequest validates the query parameters:
    • search
    • order-by: create-timestamp or update-timestamp; anything else returns 400.
    • page: integer, minimum 1.
  • UserCommentsViewModelProvider maps each result to a UserCommentEntryViewModel(comment, ?reply).
  • UserCommentsViewModel exposes page and lastPage directly, which is all paginator.html.twig reads. The existing PaginatorViewModel needs a Doctrine Paginator, which a union query cannot provide.
  • Template: app/comment/user_comments.html.twig. Draft and Resolved items get a badge.

Behaviour worth reviewing

  • The user's own draft comments are included.
  • Search does not match the text of the parent comment shown above a reply.

Tests

  • UserCommentFixtures inserts rows with raw DBAL. CommentTimestampSubscriber overwrites timestamps on persist, so fixed timestamps are impossible through the ORM.
  • .env.test gains APP_HOSTNAME=localhost and a MERCURE_JWT_SECRET of at least 256 bits. Without them, any functional test rendering an authenticated page fails with a 500 from the mercure() call in base.html.twig: the JWT key is too short, and the empty host makes public_url unparsable.

Co-authored-by: frankdekker <2179983+frankdekker@users.noreply.github.com>
Copilot AI changed the title [WIP] Add a show my comments and replies page Add "My comments and replies" overview page Oct 15, 2026
Copilot AI requested a review from frankdekker October 15, 2026 12:40
@codecov

codecov Bot commented Oct 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (ebc4d45) to head (23fa566).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##              master     #1645    +/-   ##
============================================
  Coverage     100.00%   100.00%            
- Complexity      3910      3929    +19     
============================================
  Files            685       688     +3     
  Lines          10895     11003   +108     
============================================
+ Hits           10895     11003   +108     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add a "show my comments and replies" page

2 participants