Context
Comments are not reviewed before they appear, and an approved post can still turn out to break the rules. Members need a way to flag content, and admins a way to take it down without deleting the evidence. A post that earned its approval reward (ADR-0040) and is then hidden should not keep the points, but the author may already have spent them, and the wallet must never go negative (ADR-0041).
Decision
- Members report a public post or a live comment with a reason (
SPAM,ABUSE,COPYRIGHT,MISINFORMATION,OTHER) and an optional detail of at most 400 characters. One open report per member per item is a partial unique index (… WHERE status = 'OPEN'), so concurrent duplicates collapse to one row and a second attempt is409 REPORT_ALREADY_OPEN. Reporting your own content is422 REPORT_OWN_CONTENT; content that is not public is a 404. Reports are rate-limited per address and per member (MemberThrottle). - The moderation queue (
/admin/community/moderation, next to the review queue) groups open reports per item with a count per reason, most reported first. An admin dismisses the reports (DISMISSED) or hides the item with a reason (ACTIONED). Hiding keeps the row and recordshiddenById,hiddenAtandhiddenReason;Commentgains the same three columns. Admins can unhide. Every action is written to the audit log. - A hidden post leaves the feed, its page is a 404, its comments are locked, and its author cannot edit it back into review. A hidden comment leaves the thread (a placeholder while it has live replies) and
commentCount; unhiding counts it again. - Reversing the reward. Hiding a post whose approval earned points takes them back once in the post's life: the hide claims
Post.pointsReversedAtwith a conditional update, then writes anADJUSTrow throughPointsService.debitUpTowith keypost-hidden:<postId>. Under the wallet lock it takesmin(balance, reward): - If the author is short, it deducts what is there, never below zero, and the ledger note says how many points could not be taken back (thiếu N điểm). The shortfall is not carried as a debt: the platform does not chase points the author legitimately spent before the hide. - If the balance is 0, no ledger row is written (a row never carries 0); the shortfall is recorded in thepost.hiddenaudit entry, andpointsReversedAtis still set. - Unhiding never re-grants, and hiding again after an unhide reverses nothing. - Who is told what. The author gets
CONTENT_HIDDENwith the reason (and the points taken back). Each reporter gets oneREPORT_RESOLVEDwith no link and no hint of the action, so a report cannot be used to learn what happened to someone else. - Two admins acting on one item at once: the hide is a conditional update on
hiddenAt IS NULL, so one wins and the other gets409 MODERATION_STATE_CHANGED; dismissing reports someone else just resolved is404 NO_OPEN_REPORTS.
Alternatives considered
- Carry a negative balance or a debt row for the shortfall: exact, but it needs a debt concept the wallet does not have, and makes spent points retroactively invalid. Rejected for now.
- Delete hidden content: loses the evidence an appeal or an audit needs.
- Pre-moderate comments: swamps admins; ADR-0040 already chose reports for comments.
Consequences
- Migration
20261121150000_community_moderation:Post.pointsReversedAt;Comment.hiddenById,hiddenAt,hiddenReason; a one-targetCHECKand two partial unique indexes onContentReport, plus(postId, status)and(commentId, status)indexes for the queue. - Reports on content its author later deletes drop out of the queue and stay
OPEN.