feat(moderation): add manual content review system with three-tier AI moderation
Add admin comment moderation endpoints (single and batch) and introduce a three-tier moderation system (pass/review/block) for content flagged by AI. Content with unclear violations is now held for manual review instead of being auto-rejected. Deleted the legacy audit_service.go in favor of the unified hook-based moderation system.
This commit is contained in:
@@ -107,7 +107,7 @@ func (s *CommentService) reviewCommentAsync(
|
||||
postOwnerID string,
|
||||
) {
|
||||
if s.hookManager == nil {
|
||||
if err := s.commentRepo.UpdateModerationStatus(commentID, model.CommentStatusPublished); err != nil {
|
||||
if err := s.commentRepo.UpdateModerationStatus(commentID, model.CommentStatusPublished, "", "system"); err != nil {
|
||||
zap.L().Warn("Failed to publish comment without hook manager",
|
||||
zap.Error(err),
|
||||
)
|
||||
@@ -149,6 +149,10 @@ func (s *CommentService) reviewCommentAsync(
|
||||
})
|
||||
|
||||
if !result.Approved {
|
||||
if result.NeedsReview {
|
||||
s.invalidatePostCaches(postID)
|
||||
return
|
||||
}
|
||||
if delErr := s.commentRepo.Delete(commentID); delErr != nil {
|
||||
zap.L().Warn("Failed to delete rejected comment",
|
||||
zap.String("commentID", commentID),
|
||||
@@ -159,7 +163,7 @@ func (s *CommentService) reviewCommentAsync(
|
||||
return
|
||||
}
|
||||
|
||||
if updateErr := s.commentRepo.UpdateModerationStatus(commentID, model.CommentStatusPublished); updateErr != nil {
|
||||
if updateErr := s.commentRepo.UpdateModerationStatus(commentID, model.CommentStatusPublished, "", result.ReviewedBy); updateErr != nil {
|
||||
zap.L().Warn("Failed to publish comment",
|
||||
zap.String("commentID", commentID),
|
||||
zap.Error(updateErr),
|
||||
|
||||
Reference in New Issue
Block a user