Skip to content

Feat/ssad 0111/admin reviewing comments and replies - #121

Merged
Serpantyn merged 7 commits into
devfrom
feat/SSAD-0111/admin_reviewing_comments
Mar 4, 2026
Merged

Feat/ssad 0111/admin reviewing comments and replies#121
Serpantyn merged 7 commits into
devfrom
feat/SSAD-0111/admin_reviewing_comments

Conversation

@Serpantyn

@Serpantyn Serpantyn commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

dev

Code reviewers

Summary of issue

The comment system lacked support for nested discussions (replies to comments) and required a moderation flow. Administrators needed the ability to review pending comments, understand their context within a thread, update their approval statuses, and forcefully remove inappropriate content.

Summary of change

Implemented nested comment replies and a complete administrative moderation suite.
Key changes:

  • Replies implementation: added logic to build hierarchical comment trees in memory, allowing users to see comments with their nested replies sorted by date.
  • Admin endpoints (CommentController):
    • GET /pending: gets a flat list of all comments awaiting moderation (CommentStatus.Pending), sorted from oldest to newest.
    • GET /withReplies/{id}: fetches a specific comment and its entire nested reply tree to provide context for moderation (ignores status filters).
    • PUT /updateStatus: allows admins to change a comment status (to Approved or Rejected).
    • DELETE /adminDelete/{id}: enables admins to delete any comment and its cascade of replies without ownership checks.
  • Created corresponding commands, queries, handlers, and DTOs.
  • Testing: added unit tests for all new handlers, validators, and the controller, covering tree building, sorting, and cascade deletion.

Tasks

CHECK LIST

  • СI passed
  • Сode coverage >=80%
  • All reviewers agreed to merge the PR
  • I've checked new feature as logged in and logged out user if needed
  • PR meets all conventions

@Serpantyn Serpantyn self-assigned this Mar 3, 2026
@Serpantyn Serpantyn added enhancement New feature or request task Regular task labels Mar 3, 2026
@Serpantyn Serpantyn changed the title Feat/ssad 0111/admin reviewing comments Feat/ssad 0111/admin reviewing comments and replies Mar 3, 2026
@sonarqubecloud

sonarqubecloud Bot commented Mar 3, 2026

Copy link
Copy Markdown

@Darsicl Darsicl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job

@Serpantyn
Serpantyn merged commit 4f32a18 into dev Mar 4, 2026
2 of 3 checks passed
@Serpantyn Serpantyn moved this from To Review to Sprint 6 Done in Streetcode-January-2026 Mar 4, 2026
@DrFaust555

Copy link
Copy Markdown
Contributor

Main comments

  • user can delete other people's replies. Ownership of only the root comment is checked, after which the entire subtree is deleted regardless of the authors: DeleteCommentHandler. For a regular user, tombstone/soft delete is required; the cascade can be left to the admin.
  • reply can be tied to another streetcode's comment. Only the existence of ParentId is checked: CreateCommentHandler. Such a reply disappears from both trees, and the parent can become non-deletable via FK Restrict.
  • AC about editing by the admin is not fulfilled. Issue [Requirements]Admin/Reviewing Comments #111 requires approve/edit/delete, but a regular update rejects the admin if he is not the author: UpdateCommentHandler.
  • admin API does not return Status. GetPending, GetCommentWithReplies and UpdateStatus return CommentDTO, which does not have a status: CommentDTO. In a mixed-status tree, the admin does not see which nodes have already been approved/rejected. It is better to make a separate AdminCommentDTO.
  • migration moves all old comments to Pending. defaultValue: 0, and 0 = Pending, so they disappear from the public endpoint, which only returns Approved: migration. An explicit backfill strategy for legacy data is required.

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

Labels

enhancement New feature or request task Regular task

Projects

Status: Sprint 6 Done

4 participants