You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@answer.apache.org by "rstrzelecki-inne-projekty (via GitHub)" <gi...@apache.org> on 2026/09/16 16:25:20 UTC
[PR] fix: run the reviewer on comment edits, tell the author when a comment is pending [answer]
rstrzelecki-inne-projekty opened a new pull request, #1626:
URL: https://github.com/apache/answer/pull/1626
## Proposed Changes
**Problem.** New comments go through the reviewer plugins (`ReviewService.AddCommentReview`), but **edits do not**: `CommentService.UpdateComment` writes the new text straight to the table. A user can post a harmless comment and, within the edit window, change it into anything — the review queue never sees it. Questions and answers do not have this gap (their edits are revisions), comments do.
**Changes.**
- `internal/service/comment/comment_service.go`: `UpdateComment` runs the edited text through `AddCommentReview` (same call as on creation, with IP / user agent from the request). A "needs review" / "delete" verdict updates the comment status (pending → hidden until a moderator decides; the review entry is created inside `callPluginToReview` as for new comments). Comments that are already pending / deleted are left alone.
- `internal/schema/comment_schema.go`, `internal/controller/comment_controller.go`: `UpdateCommentReq` carries IP / user agent; `UpdateCommentResp` and `GetCommentResp` expose `status`.
- `ui/src/components/Comment/index.tsx`: when the add / update response says the comment is pending (`status === 11`), the comment is not shown (or is removed from the list) and the author gets the existing `messages.post_pending` toast. Before this, a new comment sent to the queue was rendered for the author and silently vanished on the next reload.
**How to reproduce.** Enable a reviewer plugin, post an acceptable comment, edit it into something the reviewer rejects → before: the edited text is published; after: it disappears and shows up in Review, the author sees "Your post is awaiting review".
Verified on a 2.0.2 instance with a reviewer plugin: edit → `status: 11`, review entry with the plugin's reason, comment hidden from the comment list; `go build ./...`, `tsc` / `eslint` clean.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_0181uZ2px83HmPo3HKSEzWQR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org
For additional commands, e-mail: issues-help@answer.apache.org