Thread/forum side panel composer: paste, drops, reply and picker act on the panel's thread (#621) #628

Merged
charles merged 4 commits from fix/side-panel-composer into textchat 2026-11-15 11:14:59 +00:00
Owner

A thread or forum post opens in the side panel while its parent channel or forum stays the selected channel. Several things sent from the panel were resolved against the selected channel, or were wired only to the channel's composer, so they hit the wrong channel or did nothing. This is the same class of bug #624 fixed for the edit actions, and the fix works the same way: each action carries the channel of the list or composer that sent it.

What was broken

Reproduced by the new tests before the fix, for both a thread and a forum post:

  1. Pasting an image (#621). Ctrl+V in the panel's composer set the panel composer's paste request, but the shell (app.rs) only read the channel composer's, and it always sent the clipboard back to the channel's composer. So the paste did nothing.
  2. Dropping files. Drops always went to local.messages.channel(), the selected channel, and the overlay card named that channel too.
  3. Reply. StartReply, ToggleReplyMention and CancelReply resolved their channel from ui.selected_channel (chat/composer.rs on_user). Reply from the panel's hover bar, menu or double click looked the message up in the parent or forum and did nothing. The panel's reply bar "@ On" and "x" acted on the parent's draft.
  4. Expression picker. The panel composer's GIF / Media / Sticker / Emoji buttons did nothing: OpenExpressions was only handled for the channel's composer. The picker was also hidden for any composer channel other than the selected one, and PickEmoji { target: Composer } inserted into the selected channel's draft.

Found in the audit and fixed here:

  • The panel tray's "Edit attachment" set the panel composer's form, but the modal was only drawn for the channel composer's form, so nothing opened.
  • Ctrl+E / Ctrl+G / Ctrl+S always opened the picker on the selected channel.
  • A key typed while no composer was focused always went to the channel's composer.
  • Escape did not close the panel's "+" menu.
  • An emoji picked into a thread was recorded against the selected channel (composer_picks), so it was counted again when the thread's message was sent.
  • The lightbox's "Reply" (it can be opened from a panel image) used the selected channel.

The attach button ("+" → Upload a file, and the double press) already sent FileDialog::Attach { channel_id } with the thread's id. A test now covers it.

Fix

  • Core (event.rs, chat/port.rs, chat/composer.rs, chat/expressions.rs): the actions now carry their channel. StartReply { channel_id, message_id, mention }, ToggleReplyMention(channel), CancelReply(channel), PickTarget::Composer { channel_id }. on_user no longer reads ui.selected_channel at all.
  • UI:
    • main::ComposerAt::{Channel, Panel} names the screen's two composers, and ComposerAt::message wraps a composer message for either one.
    • main::take_paste_request says which composer asked for the clipboard, and app.rs sends the clipboard's contents back to that composer.
    • main::active_composer is the composer in use. That is the panel's once a thread opens in it or once it is worked in, and the channel's again once that one is worked in. Drops (main::drop_target, which the overlay card also uses), the picker shortcuts and type-to-focus go to it. Drops carry no pointer position (winit), so "the composer in use" is the stand-in. The original listens on the window from both views.
    • The picker opens on the channel of the composer whose button opened it. expressions::shown lets it show for the panel's thread, and it closes when the panel goes. Each composer's button is drawn selected only when the picker is open for its own channel (main::expression_buttons).
    • main::attachment_form returns the open "Edit attachment" form of either tray. Escape closes the panel's "+" menu.

Tests

  • crates/fluxer-ui/tests/side_panel_composer.rs (new). Each test runs for a thread of #general and for a post of the "ideas" forum, through main::update as the window drives it:
    • pasted image → thread tray (and the channel's own paste still goes to the channel)
    • drop target follows the composer in use
    • attach button → thread
    • reply from the hover bar, the reply bar's "@ On" and "x", and the double click
    • picker from the panel's button: shown, button state, emoji into the thread's draft, sticker and GIF to the thread
    • "Edit attachment" from the panel tray
    • Ctrl+E follows the composer in use
  • crates/fluxer-core/tests/chat_composer.rs: reply_and_pick_in_a_channel_not_selected.
  • Existing tests updated for the new action shapes. Their reply assertions now check the channel too.

Not done

#602 (the panel and the forum composer building ComposerOptions from composer_context) is a separate change and is not in this PR.

Refs #621

🤖 Generated with Claude Code

A thread or forum post opens in the side panel while its parent channel or forum stays the selected channel. Several things sent from the panel were resolved against the *selected* channel, or were wired only to the channel's composer, so they hit the wrong channel or did nothing. This is the same class of bug #624 fixed for the edit actions, and the fix works the same way: each action carries the channel of the list or composer that sent it. ## What was broken Reproduced by the new tests before the fix, for both a thread and a forum post: 1. **Pasting an image (#621).** Ctrl+V in the panel's composer set the *panel* composer's paste request, but the shell (`app.rs`) only read the *channel* composer's, and it always sent the clipboard back to the channel's composer. So the paste did nothing. 2. **Dropping files.** Drops always went to `local.messages.channel()`, the selected channel, and the overlay card named that channel too. 3. **Reply.** `StartReply`, `ToggleReplyMention` and `CancelReply` resolved their channel from `ui.selected_channel` (`chat/composer.rs` `on_user`). Reply from the panel's hover bar, menu or double click looked the message up in the parent or forum and did nothing. The panel's reply bar "@ On" and "x" acted on the parent's draft. 4. **Expression picker.** The panel composer's GIF / Media / Sticker / Emoji buttons did nothing: `OpenExpressions` was only handled for the channel's composer. The picker was also hidden for any composer channel other than the selected one, and `PickEmoji { target: Composer }` inserted into the selected channel's draft. Found in the audit and fixed here: - The panel tray's "Edit attachment" set the panel composer's form, but the modal was only drawn for the channel composer's form, so nothing opened. - Ctrl+E / Ctrl+G / Ctrl+S always opened the picker on the selected channel. - A key typed while no composer was focused always went to the channel's composer. - Escape did not close the panel's "+" menu. - An emoji picked into a thread was recorded against the selected channel (`composer_picks`), so it was counted again when the thread's message was sent. - The lightbox's "Reply" (it can be opened from a panel image) used the selected channel. The attach button ("+" → Upload a file, and the double press) already sent `FileDialog::Attach { channel_id }` with the thread's id. A test now covers it. ## Fix - **Core** (`event.rs`, `chat/port.rs`, `chat/composer.rs`, `chat/expressions.rs`): the actions now carry their channel. `StartReply { channel_id, message_id, mention }`, `ToggleReplyMention(channel)`, `CancelReply(channel)`, `PickTarget::Composer { channel_id }`. `on_user` no longer reads `ui.selected_channel` at all. - **UI**: - `main::ComposerAt::{Channel, Panel}` names the screen's two composers, and `ComposerAt::message` wraps a composer message for either one. - `main::take_paste_request` says which composer asked for the clipboard, and `app.rs` sends the clipboard's contents back to that composer. - `main::active_composer` is the composer in use. That is the panel's once a thread opens in it or once it is worked in, and the channel's again once that one is worked in. Drops (`main::drop_target`, which the overlay card also uses), the picker shortcuts and type-to-focus go to it. Drops carry no pointer position (winit), so "the composer in use" is the stand-in. The original listens on the window from both views. - The picker opens on the channel of the composer whose button opened it. `expressions::shown` lets it show for the panel's thread, and it closes when the panel goes. Each composer's button is drawn selected only when the picker is open for its own channel (`main::expression_buttons`). - `main::attachment_form` returns the open "Edit attachment" form of either tray. Escape closes the panel's "+" menu. ## Tests - `crates/fluxer-ui/tests/side_panel_composer.rs` (new). Each test runs for a thread of #general and for a post of the "ideas" forum, through `main::update` as the window drives it: - pasted image → thread tray (and the channel's own paste still goes to the channel) - drop target follows the composer in use - attach button → thread - reply from the hover bar, the reply bar's "@ On" and "x", and the double click - picker from the panel's button: shown, button state, emoji into the thread's draft, sticker and GIF to the thread - "Edit attachment" from the panel tray - Ctrl+E follows the composer in use - `crates/fluxer-core/tests/chat_composer.rs`: `reply_and_pick_in_a_channel_not_selected`. - Existing tests updated for the new action shapes. Their reply assertions now check the channel too. ## Not done #602 (the panel and the forum composer building `ComposerOptions` from `composer_context`) is a separate change and is not in this PR. Refs #621 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A thread or forum post opens in the side panel while its parent channel
or forum stays the selected channel. Several things sent from the panel
were resolved against ui.selected_channel, or wired to the channel's
composer only:

- Ctrl+V with an image (#621): the shell read only the channel composer's
  paste request and answered there, so the panel's paste did nothing.
- Drops went to the selected channel.
- StartReply, ToggleReplyMention and CancelReply used the selected channel.
- The panel composer's expression buttons did nothing, the picker was
  hidden for any composer but the selected channel's, and PickEmoji
  { target: Composer } inserted into the selected channel's draft.
- The panel tray's "Edit attachment" never showed its modal; Ctrl+E/G/S
  and type-to-focus always went to the channel; Escape did not close the
  panel's plus menu; a picked emoji was counted against the wrong channel.

As #624 did for the edit actions, the actions now carry the channel of the
list or composer that sent them: StartReply { channel_id, .. },
ToggleReplyMention(channel), CancelReply(channel), PickTarget::Composer
{ channel_id }. The UI names its two composers (main::ComposerAt), routes
the clipboard back to the one that asked, and sends drops, shortcuts and
typed keys to the composer in use (main::active_composer).

Tests: crates/fluxer-ui/tests/side_panel_composer.rs runs each case for a
thread and a forum post; chat_composer.rs covers the core actions in a
channel that is not the selected one.

Refs #621

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts:
- app.rs: textchat's new tick work (community icon pick) kept; the paste
  request is read from either composer (main::take_paste_request).
- expressions/mod.rs: the pick-one mode (Daily use 32) is kept on top of
  PickTarget::Composer { channel_id }; `shown` counts a pick-one picker as
  shown, so the sync that closes a panel's picker leaves it open.
- main/mod.rs: the custom status pick and the per-channel
  expect_store_change both kept.

Semantic: MentionUser (Daily use 18) names no channel; it reads the selected
channel itself now that the reducer's shared `selected` is gone. The custom
status picker sets the composer buttons through main::expression_buttons.

Refs #621

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2354c737 was committed after a soft reset onto origin/textchat, so its tree
was the PR's tree on the old textchat (c8faabf4): as a commit on e932e06c it
removed everything textchat had gained since (Daily use tasks, fixes). This
merges the PR's own commit (ccf1c87f, same tree as 2354c737, on c8faabf4)
with origin/textchat properly (d3cbc272) and takes that tree, so the
branch is the PR's change on textchat and nothing else.

Refs #621

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

Updated to textchat e932e06c (head now abf0bb06).

Important: the previous head 2354c737 was a soft-reset commit on top of e932e06c whose tree was the PR's tree on the old textchat (c8faabf4). It "merged textually" because it was a fast-forward, but it would have reverted everything textchat gained since (Daily use tasks, runtime, fixtures, goldens). The update merges the PR's real commit (ccf1c87f, identical tree to 2354c737, based on c8faabf4) with origin/textchat (d3cbc272) and abf0bb06 takes that merged tree. git diff origin/textchat abf0bb06 is now just the PR's 26 files plus one line in chat/composer.rs.

Conflicts resolved:

  • app.rs (tick): kept textchat's community-icon pick; the paste request comes from either composer (main::take_paste_request).
  • expressions/mod.rs: kept the status picker's pick-one mode (Daily use 32) with PickTarget::Composer { channel_id }; shown() treats a pick-one picker as shown, so the sync that closes a panel's picker doesn't close it.
  • main/mod.rs: kept both the custom-status emoji pick and the per-channel expect_store_change.

Other fixes after the merge:

  • MentionUser (Daily use 18) has no channel, and the reducer's shared selected was removed, so it now reads ui.selected_channel itself. Behaviour is unchanged: a Shift-click or "Mention" on a user in the thread panel still goes into the selected channel's composer. That case still needs its own follow-up.
  • The custom status's picker now sets the composer buttons through main::expression_buttons.

Textchat added no other senders of StartReply, ToggleReplyMention, CancelReply or PickTarget::Composer. The media viewer's, the message actions' and the keyboard reply paths already pass their own channel. No goldens changed.

FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci: all steps passed (including side_panel_composer, picker_images, media_viewer_layers, status::emoji_pick_one_mode, status::custom_status_modal_binds).

🤖 Generated with Claude Code

Updated to `textchat` e932e06c (head now abf0bb06). **Important:** the previous head 2354c737 was a soft-reset commit on top of e932e06c whose tree was the PR's tree on the *old* textchat (c8faabf4). It "merged textually" because it was a fast-forward, but it would have reverted everything textchat gained since (Daily use tasks, runtime, fixtures, goldens). The update merges the PR's real commit (ccf1c87f, identical tree to 2354c737, based on c8faabf4) with `origin/textchat` (d3cbc272) and abf0bb06 takes that merged tree. `git diff origin/textchat abf0bb06` is now just the PR's 26 files plus one line in `chat/composer.rs`. Conflicts resolved: - `app.rs` (tick): kept textchat's community-icon pick; the paste request comes from either composer (`main::take_paste_request`). - `expressions/mod.rs`: kept the status picker's pick-one mode (Daily use 32) with `PickTarget::Composer { channel_id }`; `shown()` treats a pick-one picker as shown, so the sync that closes a panel's picker doesn't close it. - `main/mod.rs`: kept both the custom-status emoji pick and the per-channel `expect_store_change`. Other fixes after the merge: - `MentionUser` (Daily use 18) has no channel, and the reducer's shared `selected` was removed, so it now reads `ui.selected_channel` itself. Behaviour is unchanged: a Shift-click or "Mention" on a user in the thread panel still goes into the selected channel's composer. That case still needs its own follow-up. - The custom status's picker now sets the composer buttons through `main::expression_buttons`. Textchat added no other senders of `StartReply`, `ToggleReplyMention`, `CancelReply` or `PickTarget::Composer`. The media viewer's, the message actions' and the keyboard reply paths already pass their own channel. No goldens changed. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci`: all steps passed (including side_panel_composer, picker_images, media_viewer_layers, status::emoji_pick_one_mode, status::custom_status_modal_binds). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
charles merged commit 917fc7ed0d into textchat 2026-11-15 11:14:59 +00:00
Sign in to join this conversation.
No description provided.