Open
Conversation
Migrate golangci-lint to v2 and update Go version (umputun#1965)
There was a problem hiding this comment.
Pull Request Overview
This PR adds a premoderation feature for comments with three configurable strategies: "none" (no premoderation), "first" (premoderate only the first comment from a user), and "all" (premoderate every comment). The feature allows admins to approve comments before they become visible to regular users.
- Adds premoderation logic on both frontend and backend with an admin approval UI
- Introduces filtering of unapproved comments for non-admin users
- Implements approval workflow that can approve single or multiple comments based on strategy
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
backend/app/store/comment.go |
Adds Approved boolean field to Comment struct |
backend/app/store/service/service.go |
Implements ApproveComments method supporting single and bulk approval |
backend/app/rest/api/rest.go |
Defines Premoderation type and factory function |
backend/app/rest/api/rest_public.go |
Filters unapproved comments for non-admin users in public endpoints |
backend/app/rest/api/rest_private.go |
Handles premoderation logic during comment creation |
backend/app/rest/api/admin.go |
Adds admin endpoint for approving comments |
backend/app/main.go |
Adds CLI flag for premoderation configuration |
backend/app/cmd/cmd.go |
Passes premoderation option through command structure |
backend/app/cmd/server.go |
Initializes server with premoderation strategy |
backend/app/rest/httperrors.go |
Adds error code for premoderation failures |
frontend/apps/remark42/app/common/types.ts |
Adds approved field to Comment interface |
frontend/apps/remark42/app/common/api.ts |
Adds approveComment API function |
frontend/apps/remark42/app/store/comments/actions.ts |
Adds approveComment Redux action |
frontend/apps/remark42/app/components/comment/comment.tsx |
Adds UI logic and styling for unapproved comments |
frontend/apps/remark42/app/components/comment/comment-actions.tsx |
Adds approve/disapprove button |
frontend/apps/remark42/app/components/comment/connected-comment.tsx |
Connects approve action to component |
backend/app/rest/api/rest_public_test.go |
Updates tests to handle approved field in responses |
backend/app/rest/api/admin_test.go |
Adds tests for comment approval functionality |
backend/app/store/service/service_test.go |
Adds test for ApproveComments service method |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@fedmag Hi, is it possible to add modes "with links" or/and "with images"? |
Author
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello, this is a first draft for the addition of pre-moderation.
It uses an "approved" flag to define if a comment should be visible to non-admin users.
Only admins can approve/disapprove comments.
There are 3 modes:
In the UI, I added a red border for unapproved comments so that they are easy to spot:

I'd assume this solution is not desirable, but I did not have any other idea.