feat(phase2): bulk delete + audit log; update roadmap/parity docs
This commit is contained in:
+28
-47
@@ -6,56 +6,37 @@
|
||||
|
||||
---
|
||||
|
||||
## Phase 1 — Core Chat Polish (2–3 weeks)
|
||||
## Phase 1 — Core Chat Polish ✅ COMPLETE
|
||||
|
||||
> Must-have features that every Guilded user expects. Low risk, high impact.
|
||||
|
||||
### 1.1 Direct Messages
|
||||
- **Backend:** New `conversations` table (id, type: DM/group_dm, created_at), `conversation_members` join table. New `conversation_messages` table or reuse existing `messages` with a nullable `channel_id` and a required `conversation_id`.
|
||||
- **Route:** `POST /conversations` (create DM), `GET /conversations`, `POST /conversations/{id}/messages`, `GET /conversations/{id}/messages`.
|
||||
- **WS events:** `MESSAGE_CREATE` already works; just scope to conversation members.
|
||||
- **Frontend:** New `ConversationsList` component in a sidebar panel (switch between servers view and DMs view). New `DMChatArea` or reuse `ChatArea` with a conversation context.
|
||||
- **Estimated:** 4–6 files backend, 3–4 files frontend.
|
||||
|
||||
### 1.2 Full Markdown Rendering
|
||||
- **Frontend:** Install `react-markdown` + `remark-gfm` (tables, strikethrough, task lists, autolinks). Replace the plain text renderer in `ChatArea` with `<ReactMarkdown>`.
|
||||
- **Backend:** No changes (store raw markdown).
|
||||
- **Estimated:** 1 file frontend.
|
||||
|
||||
### 1.3 Rich Embeds / Link Unfurling
|
||||
- **Backend:** On message create, scan for URLs. For each URL, fetch `<title>`, `<description>`, `<og:image>` via `og:` meta tags. Store in `embeds` table (message_id FK, url, title, description, image_url, color).
|
||||
- **Rate limit:** Max 5 embeds per message, async fetch with 2s timeout, cache for 24h.
|
||||
- **Frontend:** Render embeds as cards below the message (dark card with image, title, description).
|
||||
- **Estimated:** 2 files backend, 1 file frontend.
|
||||
|
||||
### 1.4 Message Search
|
||||
- **Backend:** Add PostgreSQL full-text search. `ALTER TABLE messages ADD COLUMN search_vector tsvector`. Create a GIN index. Add trigger to populate on insert/update.
|
||||
- **Route:** `GET /channels/{channelID}/messages/search?q=...&author_id=...&before=...&after=...&limit=25`.
|
||||
- **Frontend:** Search bar in channel header or a dedicated search panel. Highlight matching terms in results.
|
||||
- **Estimated:** 2 files backend, 2 files frontend.
|
||||
|
||||
### 1.5 Ban / Kick / Mute UI
|
||||
- **Backend:** Already have `KICK_MEMBERS` and `BAN_MEMBERS` permissions. Add:
|
||||
- `DELETE /servers/{serverID}/members/{userID}` (kick)
|
||||
- `POST /servers/{serverID}/bans` (ban, with optional reason and delete_message_days)
|
||||
- `DELETE /servers/{serverID}/bans/{userID}` (unban)
|
||||
- `GET /servers/{serverID}/bans` (list bans)
|
||||
- `bans` table (server_id, user_id, reason, banned_by, created_at)
|
||||
- Mute: `server_mutes` table (server_id, user_id, muted_by, expires_at, reason). New permission `MUTE_MEMBERS`. Muted users cannot send messages or speak in voice.
|
||||
- **Frontend:** Context menu on member list items (right-click or three-dot menu) with Kick/Ban/Mute options. Confirmation modals for each action.
|
||||
- **Estimated:** 3 files backend, 2 files frontend.
|
||||
|
||||
### 1.6 Slowmode
|
||||
- **Backend:** Add `slowmode_seconds` column to `channels`. New permission `MANAGE_SLOWMODE`. In message Create handler, check if user's last message in this channel was within `slowmode_seconds`; if so, return 429 with retry-after.
|
||||
- **Frontend:** Show cooldown timer on the message input when slowmode is active. Channel settings to configure slowmode (0/5/10/30/60/120/300 seconds).
|
||||
- **Estimated:** 2 files backend, 2 files frontend.
|
||||
| # | Feature | Status |
|
||||
|---|---------|--------|
|
||||
| 1.1 | Direct Messages | ✅ Backend + frontend live |
|
||||
| 1.2 | Full Markdown Rendering | ✅ `react-markdown` + `remark-gfm` |
|
||||
| 1.3 | Rich Embeds / Link Unfurling | ✅ `internal/embed`, `embeds` table |
|
||||
| 1.4 | Message Search | ✅ PostgreSQL full-text search |
|
||||
| 1.5 | Ban / Kick / Mute UI | ✅ `internal/moderation`, `MemberContextMenu` |
|
||||
| 1.6 | Slowmode | ✅ DB column + message handler + UI |
|
||||
|
||||
---
|
||||
|
||||
## Phase 2 — Moderation & Permissions (2–3 weeks)
|
||||
## Phase 2 — Moderation & Permissions 🔄 IN PROGRESS
|
||||
|
||||
> Unlocks serious server organization. Guilded's strength was granular permissions.
|
||||
|
||||
---
|
||||
|
||||
## Phase 2 — Moderation & Permissions 🔄 IN PROGRESS
|
||||
|
||||
| # | Feature | Status |
|
||||
|---|---------|--------|
|
||||
| 2.1 | Per-Channel Permission Overrides | Pending |
|
||||
| 2.2 | Expanded Permission Flags | ✅ Already added in `internal/permissions/permissions.go` |
|
||||
| 2.3 | Role Colors & Hierarchy | ✅ DB columns present; UI pending |
|
||||
| 2.4 | Audit Log | In progress |
|
||||
| 2.5 | Bulk Message Delete | In progress |
|
||||
|
||||
### 2.1 Per-Channel Permission Overrides
|
||||
- **Backend:** New `channel_overrides` table (channel_id, target_type: role/user, target_id, allow_bitflags, deny_bitflags). Extend permission checker to layer channel overrides on top of role permissions.
|
||||
- **Route:** `PUT /channels/{channelID}/permissions/{targetType}/{targetID}`, `GET /channels/{channelID}/permissions`, `DELETE /channels/{channelID}/permissions/{targetType}/{targetID}`.
|
||||
@@ -63,14 +44,14 @@
|
||||
- **Estimated:** 3 files backend, 2 files frontend.
|
||||
|
||||
### 2.2 Expanded Permission Flags
|
||||
- Add: `CREATE_INSTANT_INVITE`, `CHANGE_NICKNAME`, `MANAGE_NICKNAMES`, `MANAGE_ROLES`, `MANAGE_WEBHOOKS`, `EMBED_LINKS`, `ATTACH_FILES`, `ADD_REACTIONS`, `USE_EXTERNAL_EMOJIS`, `MENTION_EVERYONE`, `MUTE_MEMBERS`, `DEAFEN_MEMBERS`, `MOVE_MEMBERS`.
|
||||
- Update permission checker to gate the corresponding handlers.
|
||||
- **Estimated:** 2 files backend.
|
||||
- **Status:** ✅ Bits already defined and seeding default permissions.
|
||||
- **Remaining:** Gate the corresponding handlers (webhooks, file upload, external emojis, mention everyone, voice mute/deaf/move).
|
||||
- **Estimated:** 1 file backend.
|
||||
|
||||
### 2.3 Role Colors & Hierarchy
|
||||
- **Backend:** Add `color` (hex string) and `position` (integer) columns to `roles`. Permission resolution uses highest-position role's color.
|
||||
- **Frontend:** Role editor with color picker. Member names shown in their highest role color in chat and member list.
|
||||
- **Estimated:** 2 files backend, 2 files frontend.
|
||||
- **Status:** ✅ `color` and `position` columns already exist on `roles`.
|
||||
- **Remaining:** Render member names in highest-position role color in chat and member list.
|
||||
- **Estimated:** 2 files frontend.
|
||||
|
||||
### 2.4 Audit Log
|
||||
- **Backend:** New `audit_log` table (server_id, user_id, action_type, target_type, target_id, reason, changes JSONB, created_at). Instrument all moderation actions (kick, ban, mute, role changes, channel CRUD, server settings changes) to write audit entries.
|
||||
|
||||
Reference in New Issue
Block a user