Chat Moderation
Overview
Admins and Moderators can manage chat rooms, delete inappropriate messages, and ban disruptive users. All moderation actions propagate in real time to connected clients via STOMP broadcasts.
Workflow
Step-by-Step: Create a Chat Room
- Navigate to Admin → Chat (
/admin/chat). - Click "Create Room".
- Fill in: slug (URL-friendly ID), name, topic, room type (PUBLIC / MEMBERS_ONLY / MODEL_SPECIFIC).
- Click "Save".
- The room is immediately available to members.
Step-by-Step: Delete a Message
- In the admin chat view, find the message to remove.
- Click the delete icon next to the message.
- The message is soft-deleted (
isDeleted = true) and aMESSAGE_DELETEDevent is broadcast. - All connected users see the message replaced by "[Message removed]" in real time.
Step-by-Step: Ban a User
- Navigate to Admin → Chat → Bans tab.
- Click "Ban User".
- Enter the user ID (or search by name/email) and provide a reason.
- Click "Confirm Ban".
- The user is immediately prevented from sending messages.
Step-by-Step: Lift a Ban
- Navigate to the Bans tab in Admin Chat.
- Find the banned user.
- Click "Lift Ban".
- The
ChatBanEntity.liftedAtis set — the user can chat again.
Security Notes
- ADMIN / ROOT_ADMIN: create rooms, ban users.
- ADMIN / MODERATOR: delete messages, manage bans.
- Soft-deleted messages are filtered from new clients connecting — they never receive deleted content.
- Bans are user-level (not IP-based) — a banned user cannot bypass by opening a new tab.
QA Checklist
- Create room → appears in member chat room list
- Delete message → instantly removed from all connected clients' views
- Ban user → banned user gets error when trying to send message
- Lift ban → user can send messages again
- Access admin chat endpoints as MODERATOR → can delete messages but not create rooms