Text chat 46: New forum post composer (#331) #472

Manually merged
charles merged 3 commits from textchat-46-ui-forum-composer into textchat 2026-11-13 17:17:39 +00:00
Owner

Stacked on: textchat-45-ui-forum-view

What

The new forum/media post composer (spec §18.2.1 "Create", §18.2.2), replacing Task 45's title stub in the search card's place:

  • forum/composer.rs: title input ("Give your post a title", 1.25 rem semibold, 100 chars, Enter moves focus to the body), X "Discard post"; body = the Text chat 25 editor via ComposerOptions { send_on_enter: false, slash_commands: false, typing: false, draft_key: DraftKey::Other(forum) } (Enter/Ctrl+Enter never send, Up never edits), upload tray above it, autocomplete popup inline; preview ("Preview"/"Edit", Markdown or "Nothing to preview yet."); cooldown hint and error strings from the store; bar with "Add images or files" (file dialog on the forum's draft), "Add emoji" (expression picker on the Emojis tab), tags, preview toggle, "Post" (disabled unless can_submit). While the post's files go up, their progress cards (with "Cancel upload") show in the card. Failure toast is Task 45's forum toast.
  • forum/composer_tags.rs: "Add tags" + chosen pills (click removes) + "Required"; popout with every tag, moderated ones disabled without MANAGE_THREADS, all unchosen ones disabled at 5, "You can pick up to 5 tags."
  • Media channels: "Add a description (optional)" placeholder and the media-required error come from the core model.

Deviations / outside the Files list (minimal)

  • composer/mod.rs: new pub fn editor(..) (the text box alone); view_with now calls it.
  • main/mod.rs: routes forum::Message::Composer with the screen's composer state (the body is local.messages.composer, which already follows the selected channel = forum draft, so paste, drop and emoji picks work unchanged); "Add emoji" toggles the expression picker. forum::view takes the composer state.
  • app.rs: focuses the title when the composer opens and the body on title Enter (forum.composer.take_focus()).
  • theme/icons.rs + assets/icons/{tag-bold,eye-bold}.svg (Phosphor 2.1.10 bold path data, from the fork's node_modules).
  • toolbar::composer_stub removed (replaced).
  • The draft is keyed by the forum id in the core (Task 39), not the string forum-post:{forum}; DraftKey::Other(forum) points at it.
  • iced has no dashed border: the preview box border is solid. The bar's negative inline margins are not reproduced.
  • docs/screenshots/README.md: rows for the three new screenshots.

Tests

  • crates/fluxer-ui/tests/forum_composer.rs: title_enter_moves_to_body, post_enabled_rules, tag_picker_limit_and_required, preview_toggle, media_placeholder_and_error, submit_emits_submit_post, discard_closes (seen failing before the implementation, then passing).
  • Screenshots forum_composer, forum_composer_tags, media_composer (goldens in fixtures/golden/).
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally (Linux). No FLUXER_DESKTOP_TESTS tests in this task.
  • Found and filed #470: the apps/fluxer lib test binary sometimes aborts at exit (glibc mutex assertion) after all tests pass; seen on the base, about 1 run in 5.

Closes #331

🤖 Generated with Claude Code

Stacked on: textchat-45-ui-forum-view ## What The new forum/media post composer (spec §18.2.1 "Create", §18.2.2), replacing Task 45's title stub in the search card's place: - `forum/composer.rs`: title input ("Give your post a title", 1.25 rem semibold, 100 chars, Enter moves focus to the body), X "Discard post"; body = the Text chat 25 editor via `ComposerOptions { send_on_enter: false, slash_commands: false, typing: false, draft_key: DraftKey::Other(forum) }` (Enter/Ctrl+Enter never send, Up never edits), upload tray above it, autocomplete popup inline; preview ("Preview"/"Edit", Markdown or "Nothing to preview yet."); cooldown hint and error strings from the store; bar with "Add images or files" (file dialog on the forum's draft), "Add emoji" (expression picker on the Emojis tab), tags, preview toggle, "Post" (disabled unless `can_submit`). While the post's files go up, their progress cards (with "Cancel upload") show in the card. Failure toast is Task 45's forum toast. - `forum/composer_tags.rs`: "Add tags" + chosen pills (click removes) + "Required"; popout with every tag, moderated ones disabled without MANAGE_THREADS, all unchosen ones disabled at 5, "You can pick up to 5 tags." - Media channels: "Add a description (optional)" placeholder and the media-required error come from the core model. ## Deviations / outside the Files list (minimal) - `composer/mod.rs`: new `pub fn editor(..)` (the text box alone); `view_with` now calls it. - `main/mod.rs`: routes `forum::Message::Composer` with the screen's composer state (the body *is* `local.messages.composer`, which already follows the selected channel = forum draft, so paste, drop and emoji picks work unchanged); "Add emoji" toggles the expression picker. `forum::view` takes the composer state. - `app.rs`: focuses the title when the composer opens and the body on title Enter (`forum.composer.take_focus()`). - `theme/icons.rs` + `assets/icons/{tag-bold,eye-bold}.svg` (Phosphor 2.1.10 bold path data, from the fork's node_modules). - `toolbar::composer_stub` removed (replaced). - The draft is keyed by the forum id in the core (Task 39), not the string `forum-post:{forum}`; `DraftKey::Other(forum)` points at it. - iced has no dashed border: the preview box border is solid. The bar's negative inline margins are not reproduced. - `docs/screenshots/README.md`: rows for the three new screenshots. ## Tests - `crates/fluxer-ui/tests/forum_composer.rs`: `title_enter_moves_to_body`, `post_enabled_rules`, `tag_picker_limit_and_required`, `preview_toggle`, `media_placeholder_and_error`, `submit_emits_submit_post`, `discard_closes` (seen failing before the implementation, then passing). - Screenshots `forum_composer`, `forum_composer_tags`, `media_composer` (goldens in `fixtures/golden/`). - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally (Linux). No FLUXER_DESKTOP_TESTS tests in this task. - Found and filed #470: the `apps/fluxer` lib test binary sometimes aborts at exit (glibc mutex assertion) after all tests pass; seen on the base, about 1 run in 5. Closes #331 🤖 Generated with [Claude Code](https://claude.com/claude-code)
CancelUpload on a forum-post upload job put the draft back but left
ForumComposer.pending as Upload(nonce); the runtime reports nothing
after a cancel, so the composer stayed submitting. Forums now clears it.
Also document why the post body draft is keyed by the forum id rather
than the spec's forum-post:{forum}.

Refs #324

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Forum and media channels show the forum view (spec §18.2.1) in place of the
message view: collapsible guidelines, the search card with "New post" and
Shift+Enter, the filter row with the "Sort & view" popout and tag pills,
list and gallery cards (columns from width), skeletons, empty/search-empty/
error/indexing states, "Older posts" and "Load older posts", the post
context menu (Pin/Unpin post, Edit tags and ForumPostTagsModal). A card
click opens the post in the side panel, Shift+click the full view; the
panel uses PanelHeader::ForumPost and shows ForumPostActions under the
starter. Visible post ids are reported with ForumAction::Visible.

Tests in tests/forum.rs; screenshots forum_list, forum_gallery,
forum_sort_popout, forum_empty, forum_post_panel.

Refs #330

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	crates/fluxer-ui/src/app.rs
Refs #331

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #331

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Independent review: Text chat 46 (new forum post composer)

I reviewed 78e5dc5..251d4bb without relying on the implementer's notes.

Plan tests: all 7 named tests are in crates/fluxer-ui/tests/forum_composer.rs: title_enter_moves_to_body, post_enabled_rules, tag_picker_limit_and_required, preview_toggle, media_placeholder_and_error, submit_emits_submit_post and discard_closes. They assert the spec's strings and values:

  • the title placeholder "Give your post a title" and the 100-character limit
  • "Add images or files", "Add emoji", "Post", "Add tags" and "Required"
  • "You can pick up to 5 tags." The sixth tag is disabled and a click on it does nothing.
  • a moderated tag is disabled for a user without MANAGE_THREADS
  • "Preview"/"Edit" and "Nothing to preview yet."
  • the slowmode text "You can start another thread in 7 seconds."
  • "Add a description (optional)" in a media channel and "Enter a message" in a forum
  • "Attach an image or a video to post in a media channel."
  • CreateForumPost carries the name, applied_tags and the content
  • Enter and EditLast in the body send nothing
    All 3 screenshots are present (forum_composer, forum_composer_tags, media_composer), and I checked them by eye.

Interfaces: the composer uses ComposerOptions { send_on_enter: false, slash_commands: false, typing: false, draft_key: DraftKey::Other(forum) }. The core stops typing announcements for the forum composer (chat/composer.rs:273). The card border is background_modifier_accent_focus. The "Couldn't create the post" toast and the validation strings come from the core (ForumComposerError). The moderated-tag tooltip is on tags::pill_with (Task 45). No other task's interface is broken. forum::view now also takes the text-box state, and every caller in the tree is updated.

Invariants: the diff only touches fluxer-ui, docs and goldens. It adds no I/O path and no dependency. The file dialog goes through UserAction::OpenFileDialog. It adds no fixtures, and I found no secrets, URLs or paths. The title is cut to 100 chars in the UI and to 100 UTF-16 units in the core (cut_utf16), so the title matches the server's limit.

Findings

  • (minor) forum/composer.rs upload() picks the newest job with max_by on the nonce string. That is right only while nonces have the same length. In practice there is one upload at a time per forum, so this is cosmetic.
  • (minor) The preview border is solid where the original's is dashed, because iced has no dashed borders. The code notes this, and it is acceptable.
  • (minor) forum::update drops Message::Composer(Body(..)) (no text-box state). That is correct because main::update routes it first, but only the main screen's routing makes the body work. A future caller that bypasses main::update would lose keystrokes silently.

Local CI: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a clean review worktree passed every step (exit 0). The sporadic glibc abort (#470) did not show up in this run.

Verdict: approve. There are no blocking findings and local CI is green.

## Independent review: Text chat 46 (new forum post composer) I reviewed `78e5dc5..251d4bb` without relying on the implementer's notes. **Plan tests:** all 7 named tests are in `crates/fluxer-ui/tests/forum_composer.rs`: `title_enter_moves_to_body`, `post_enabled_rules`, `tag_picker_limit_and_required`, `preview_toggle`, `media_placeholder_and_error`, `submit_emits_submit_post` and `discard_closes`. They assert the spec's strings and values: - the title placeholder "Give your post a title" and the 100-character limit - "Add images or files", "Add emoji", "Post", "Add tags" and "Required" - "You can pick up to 5 tags." The sixth tag is disabled and a click on it does nothing. - a moderated tag is disabled for a user without MANAGE_THREADS - "Preview"/"Edit" and "Nothing to preview yet." - the slowmode text "You can start another thread in 7 seconds." - "Add a description (optional)" in a media channel and "Enter a message" in a forum - "Attach an image or a video to post in a media channel." - `CreateForumPost` carries the name, `applied_tags` and the content - Enter and EditLast in the body send nothing All 3 screenshots are present (`forum_composer`, `forum_composer_tags`, `media_composer`), and I checked them by eye. **Interfaces:** the composer uses `ComposerOptions { send_on_enter: false, slash_commands: false, typing: false, draft_key: DraftKey::Other(forum) }`. The core stops typing announcements for the forum composer (`chat/composer.rs:273`). The card border is `background_modifier_accent_focus`. The "Couldn't create the post" toast and the validation strings come from the core (`ForumComposerError`). The moderated-tag tooltip is on `tags::pill_with` (Task 45). No other task's interface is broken. `forum::view` now also takes the text-box state, and every caller in the tree is updated. **Invariants:** the diff only touches `fluxer-ui`, docs and goldens. It adds no I/O path and no dependency. The file dialog goes through `UserAction::OpenFileDialog`. It adds no fixtures, and I found no secrets, URLs or paths. The title is cut to 100 chars in the UI and to 100 UTF-16 units in the core (`cut_utf16`), so the title matches the server's limit. **Findings** - (minor) `forum/composer.rs` `upload()` picks the newest job with `max_by` on the nonce *string*. That is right only while nonces have the same length. In practice there is one upload at a time per forum, so this is cosmetic. - (minor) The preview border is solid where the original's is dashed, because iced has no dashed borders. The code notes this, and it is acceptable. - (minor) `forum::update` drops `Message::Composer(Body(..))` (no text-box state). That is correct because `main::update` routes it first, but only the main screen's routing makes the body work. A future caller that bypasses `main::update` would lose keystrokes silently. **Local CI:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a clean review worktree passed every step (exit 0). The sporadic glibc abort (#470) did not show up in this run. **Verdict: approve.** There are no blocking findings and local CI is green.
charles manually merged commit c1390123e5 into textchat 2026-11-13 17:17:34 +00:00
Sign in to join this conversation.
No description provided.