Skip to content

[ADMIN-001] Add admin moderation dashboard - #87

Open
chev0004 wants to merge 4 commits into
developfrom
feat/admin-001
Open

[ADMIN-001] Add admin moderation dashboard#87
chev0004 wants to merge 4 commits into
developfrom
feat/admin-001

Conversation

@chev0004

@chev0004 chev0004 commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Outline

Summary

Adds the admin moderation dashboard: a report queue with reporter and reported-user context, moderation actions (dismiss, warn, hide profile, suspend, ban, plus reversals), a persistent audit log, and enforcement so hidden profiles leave public surfaces and suspended or banned users lose access to protected APIs.


Changes & Enhancements

  • Type of Change:
    • Feature
    • Bugfix
    • Refactor
    • Chore
  • Changes:
    • (Database):
      • Add suspended_until and banned_at to users, hidden_by_moderation to profiles.
      • Add moderation_actions audit table and moderation_action enum.
      • Add warning notification kind.
    • (Server):
      • Add src/db/moderation.ts with report queue, audit log, and moderation state helpers.
      • Exclude hidden, banned, and suspended profiles from discovery, search-by-id, and public profile queries.
      • Add getActiveUser and use it in profile, bump, report, block, saved, settings, onboarding, and notifications APIs so restricted users get 401.
      • Add admin-only POST /api/admin/moderation applying actions to a report's target and logging every action.
    • (Admin UI):
      • Add /[lang]/admin route, guarded by the existing POLYCORD_ADMIN_USER_IDS allowlist, with the report queue, per-report action buttons, moderation state chips, and the audit log.
    • (Inbox):
      • Warn action creates a warning notification; the inbox renders moderation warning copy for all users.
    • (i18n):
      • Add Admin section and inbox warning copy to en and ja.

Page / App Changes

Affected Next.js Routes (Local):

  • /[lang]/admin (new admin moderation dashboard)
  • /[lang] (discovery excludes moderated profiles)
Before (Screenshot)
After (Screenshot)

Component / Storybook Changes

Affected Storybook Components (Local):

Before (Screenshot)
After (Screenshot)

Not Doing

  • Suspend duration is fixed at 7 days in the UI; the API already accepts 1 to 90 days for later controls.

Other (Remarks)

This PR and #86 each add a migration numbered 0012 on independent branches. Whichever merges second needs drizzle/meta/_journal.json reconciled (rename one migration to 0013 and update its journal entry).


Checklists

  • Code is well-documented (comments, JSDoc, etc.).
  • Existing comments were updated as needed.
  • No out-of-scope changes are included.
  • Write TODO comments where future work is required.
  • Removed unnecessary debug code (e.g., console.log, debugger).
  • Self-reviewed and tested locally.

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.

1 participant