feat(forum): traditional forum layout with post actions (#130)#131
Conversation
Revamp the forum channel UI from a bare ListTile list into a forum-style board with per-post management. Forum index (forum_view.dart): - Richer rows: author avatar, title with pinned badge, created/last-reply metadata, content preview, and reply-count chip. - Sort control: latest activity (default), newest, most replies; pinned posts float to the top. Post count + pull-to-refresh. - Per-post actions (overflow / long-press / right-click): open, edit (author), pin/unpin (mods), delete (author or mods) — permission-gated. - Fix the "(untitled)" leak: fall back to the first body line, then "Untitled post". Thread view (thread_view.dart): - Per-message actions (copy/edit/delete) for the editable root post and replies, mirroring the main message view. - showAccordThread returns a ThreadResult so a root edit/delete refreshes the forum row. Wire canManageMessages + currentUserId through the callers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Cache _sorted in build() so it is sorted once per rebuild, not once per visible item (O(n log n) per scroll event → O(n log n) per build) - Fix _togglePin to reassign _posts like all other mutations, instead of mutating the AccordMessage in place while leaving _posts unchanged - Expose _postTitle as resolveForumPostTitle so it can be unit-tested - Wrap ThreadView Dialog in PopScope(canPop:false) so back-nav and scrim taps surface a root-post edit to the caller — previously only the explicit close button did this - Simplify showActions (≡ _canDelete) in _MessageLineState.build() - Style the Delete button in confirmDeletePost with error colour so it reads as a destructive action - Add forum_view_logic_test.dart: unit tests for resolveForumPostTitle fallback chain and ThreadResult constructors https://claude.ai/code/session_01Qb97WPiDoXeH35NECiu4X5
Code Review — findings & fixes (commit 6880e3e)All issues below have been fixed and pushed to the PR branch. Ranked by severity. 🔴 HIGH — Bug: thread close via scrim/back-nav silently drops root editsFile: The code comment said "a back/scrim dismiss should still surface that edit to the caller" but only the explicit Fix: Wrapped the 🔴 HIGH — Performance:
|
Closes #130.
Revamps the forum channel UI from a bare
ListTilelist into a traditional forum board with the post-management affordances people expect.Forum index (
forum_view.dart)by Author · created · last reply …), a content preview, and a reply-count chip.(untitled)leak: falls back to the first body line, then "Untitled post".Thread view (
thread_view.dart)showAccordThreadnow returns aThreadResultso a root edit/delete inside the thread refreshes the forum row without a full reload.Wiring
accord_home_messages.dartpassescanManageMessages+currentUserIdintoForumChannelView.accord_home_message_row.dartpassescanManageMessagesintoshowAccordThread.Permissions reuse the existing
manage_messagescomputation andisOwnchecks; the edit/delete/pin endpoints already existed inMessagesApi.Acceptance criteria
Not included: tag/category filtering and a locked badge —
AccordMessage/AccordChannelhave no tag or per-post lock fields yet, so there's no data to drive them.Testing
flutter analyze --no-fatal-infos— clean on changed files.flutter test— all 274 tests pass.🤖 Generated with Claude Code