Skip to content

feat(social): moderation hooks & governance integration (BE-093) - #882

Open
Ire12 wants to merge 1 commit into
BlockDash-Studios:mainfrom
Ire12:feat/846-moderation-hooks-governance
Open

Ire12 wants to merge 1 commit into
BlockDash-Studios:mainfrom
Ire12:feat/846-moderation-hooks-governance

Conversation

@Ire12

@Ire12 Ire12 commented Sep 25, 2026 •

Copy link
Copy Markdown

Overview

Implements BE-093 — moderation hooks & governance integration for the social feed (BackendAcademy). Posts and comments can be flagged through a REST surface, a flagged target is hidden pending review, every state change is appended to an immutable audit trail, and the decision itself is delegated to a pluggable ContentVerdictHook so the future on-chain governance contract can vote on content without BE-093 depending on it.

Related Issue

#846 — BE-093 — moderation hooks & governance integration

Changes

Moderation surface

  • [ADD] BackendAcademy/src/social/content-moderation.service.ts

    • report() files a ContentReport and moves the target to hidden in the same call, so abusive content stops being served before anyone reviews it.
    • getQueue() exposes open reports; isVisible() / filterVisible() are the read-side guard.
    • registerVerdictHook() + adjudicate() consult hooks in registration order and apply the first verdict: restore returns the content to visible, remove leaves it removed.
    • getAuditTrail() returns the append-only trail (reported → hidden → restored/removed), each entry carrying actor, action, timestamp and report id.
  • [ADD] BackendAcademy/src/social/dto/report-content.dto.ts

    • Validates targetKind (post | comment), targetId, reporterId, reason and details.
  • [ADD] BackendAcademy/src/social/content-moderation.service.spec.ts

    • Covers hiding plus audit trail, a verdict hook restoring content (and the double-adjudication guard), and abstaining hooks leaving content hidden.
  • [MODIFY] BackendAcademy/src/social/social.types.ts

    • Adds ModerationTargetKind, ModerationState, ContentReport, ModerationAuditEntry, ModerationVerdict and ContentVerdictHook.
  • [MODIFY] BackendAcademy/src/social/social.controller.ts

    • Adds POST /social/reports, GET /social/moderation/queue and GET /social/moderation/audit.
    • Feed, showcase and hashtag read paths now run through filterVisible, so hidden content is never returned.
  • [MODIFY] BackendAcademy/src/social/social.module.ts

    • Registers and exports ContentModerationService.

Verification Results

Implemented through the GitHub REST API (no local clone; the project's build and test suite were not run in this session).
Acceptance criteria mapping:
✅ Reported content hidden pending review — report() sets the target to `hidden` and read paths filter it out
✅ Audit trail kept — append-only ModerationAuditEntry list, never edited or deleted
✅ Report/flag endpoint for posts and comments — POST /social/reports with targetKind post | comment
✅ Moderation queue — GET /social/moderation/queue returns open reports
✅ Hook for future governance contract voting — ContentVerdictHook via registerVerdictHook()/adjudicate()
Acceptance Criteria Status
Reported content hidden pending review ✅ report() moves the target to hidden immediately; filterVisible() guards the feed, showcase and hashtag read paths
Audit trail kept ✅ Append-only getAuditTrail() entries recording action, actor, timestamp and report id
Report/flag endpoints for posts and comments ✅ POST /social/reports with targetKind: post | comment
Moderation queue ✅ GET /social/moderation/queue returns open reports
Hooks for future governance contract voting ✅ ContentVerdictHook registered via registerVerdictHook(), applied by adjudicate(); content stays hidden while every hook abstains

Unit tests were added but not executed here — this session had no checkout of the repo and was API-only, so no green run is claimed.

Closes #846

@drips-wave

drips-wave Bot commented Sep 25, 2026

Copy link
Copy Markdown

@Ire12 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Ire12

Ire12 commented Sep 27, 2026

Copy link
Copy Markdown
Author

Merge conflict with main resolved

Pushed merge commit f680d4587f into this branch (main @ 7aa030964c). This is a merge commit, not a force-push, so the commit history is intact.

Conflicting file(s) resolved:

  • BackendAcademy/src/social/social.controller.ts[union]
  • BackendAcademy/src/social/social.module.ts[union]

The pull request is mergeable again — CI will re-run on the new head. @MaryammAli ready for review and merge when you have a moment.

@Ire12
Ire12 force-pushed the feat/846-moderation-hooks-governance branch from f680d45 to 76f23d2 Compare October 8, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BE-093 — Moderation hooks & governance integration

2 participants