39 moderation panel#77
Merged
sametekinpolat merged 7 commits intodevelopmentfrom May 3, 2026
Merged
Conversation
…39) - Extend ModActionType enum with 13 new governance and audit action types - Add CommunityStatus enum (ACTIVE, CLOSED) for community lifecycle - Add status field to Community model (default ACTIVE) - Add performance indexes on Report, CommunityRestriction, ModLog, Post, Comment - Create src/lib/moderation/permissions.ts with getModerationContext() helper that resolves global mod, owner, and community mod flags in one parallel DB round-trip, eliminating per-permission N+1 queries - Create migration SQL for all schema changes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reports: resolveReportAction, dismissReportAction Content: removePostAction, removeCommentAction, pinPostAction Restrictions: muteUserAction, banUserAction, revokeRestrictionAction Settings: deleteRuleAction Governance: assignModeratorAction, removeModeratorAction, updateModeratorPermissionsAction, closeCommunityAction, reopenCommunityAction, transferOwnershipAction, deleteCommunityAction All actions: - Gate on getModerationContext() for scope-aware permission checks - Write a ModLog entry inside the same transaction as the data mutation - Prevent self-restriction and owner lock-out edge cases - Return structured error/success for client feedback Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pages: - /moderation — global mod panel listing all communities with pending report counts; guards to GlobalModerator record server-side - /communities/[name]/moderation — community-scoped panel; guards via getModerationContext, redirects non-mods Components (src/components/moderation/): - panel.tsx — tabbed shell with role-context header and badge on Reports - reports-tab.tsx — resolve/dismiss with status filter, optimistic update - posts-tab.tsx — remove + pin/unpin with per-row reason input - comments-tab.tsx — remove with reason input, all/removed filter - restrictions-tab.tsx — add mute/ban form + active restriction list with revoke; duplicate-restriction check runs server-side - mod-log-tab.tsx — full audit trail with action-type filter - settings-tab.tsx — add/reorder/delete community rules - governance-tab.tsx — moderator roster (assign, update perms, remove), community close/reopen, transfer ownership, delete community; owner-only danger-zone clearly separated from shared mod controls Community page: - Wire getModerationContext() to replace duplicated per-permission queries - Propagate hasModerationAccess prop down to show "Moderation Panel" link in sidebar for any user with moderation access (global mod, owner, mod) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… and panel
- Change Prisma import from type-only to value import so Prisma.DbNull
can be used as a runtime value for nullable JSON fields in ModLog.details
- Use `satisfies` constraint + explicit `as Tab` casts in panel tab array
to satisfy the { id: Tab } narrowing requirement
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
closes #39 #76 #75 #74