Overview
The forum system includes comprehensive moderation features including automatic NSFW detection, soft/hard deletion, archival, and role-based permission controls.Moderation Flow
Automatic Moderation
NSFW Detection
All content is automatically moderated using the OpenAI moderation API:src/lib/moderation.ts
Content Filtering
NSFW content is automatically filtered from public queries:src/lib/actions/forum/topics.ts
Manual Moderation
Soft Delete
Soft deletion hides content but preserves it for potential recovery:src/lib/actions/forum/topics.ts
Restore Deleted Content
src/lib/actions/forum/topics.ts
Hard Delete
Permanent deletion removes content from the database:src/lib/actions/forum/topics.ts
Archive Content
Archiving moves content to an archived state:src/lib/actions/forum/topics.ts
Permission System
RBAC Integration
The forum uses a role-based access control (RBAC) system:src/lib/actions/forum/admin.ts
Permission Modules
Available permission modules:forums.topics.create- Create new topicsforums.topics.archive- Archive, restore, and soft delete topicsforums.posts.create- Create posts (bypasses VP requirements)forums.attachments.create- Upload attachmentsforums.attachments.manage- Delete/archive attachments
Using Permissions in Components
Admin Roles
Role Hierarchy
- Super Admin - Has all permissions across all DAOs
- Admin - Can manage topics, posts, and moderate content
- DUNA Admin - Specialized role for DUNA category management
Admin Badge
Display admin badges on user content:src/components/Forum/ForumAdminBadge.tsx
Audit Logging
All admin actions are logged for accountability:src/lib/actions/forum/admin.ts
Audit Log Schema
Tracked Actions
DELETE_TOPIC- Hard delete topicRESTORE_TOPIC- Restore soft-deleted topicARCHIVE_TOPIC- Archive topicDELETE_POST- Hard delete postRESTORE_POST- Restore soft-deleted postDELETE_ATTACHMENT- Delete attachmentARCHIVE_ATTACHMENT- Archive attachment
Soft Deleted Content Display
Show soft-deleted content to authors and admins:src/components/Forum/SoftDeletedContent.tsx
Permission Utilities
src/lib/forumUtils.ts
Best Practices
Use soft deletion by default
Use soft deletion by default
Prefer soft deletion over hard deletion to allow content recovery and maintain data integrity.
Log all admin actions
Log all admin actions
Always log administrative actions for accountability and auditing purposes.
Verify permissions
Verify permissions
Check permissions on both client and server side for security.
Filter NSFW content
Filter NSFW content
Always exclude NSFW content from public queries while preserving it for admin review.
Provide restoration options
Provide restoration options
Give admins the ability to restore accidentally deleted content.
Next Steps
Topics & Posts
Learn about creating and managing content
Search
Update search indexes when moderating content