Cards answer like their message: pins not loaded, spoilers, search, inbox, thread panel menu (#849) #862

Closed
charles wants to merge 0 commits from fix-849-inert-cards into textchat
Owner

Closes #849

Follow-up of #850. All four items of #849 are in this PR. Each one was driven headlessly on the real main screen (iced widget protocol, software renderer, 1600 × 900, the textchat READY), clicked through main::update and the store, and compared with the original (ChannelPinsContent.tsx, ChannelSearchResults.tsx + SearchResultRowClick.ts + ChannelSearchResultsShared.tsx, SavedMessagesContent.tsx, RecentMentionsContent.tsx, UserMessage.tsx).

Causes and fixes

  1. A pin that is not loaded had no menu, and its picture did not open. The message menu (chat::actions::message_actions), the actions it sends (sent/record in chat/actions.rs) and the lightbox (MediaPlayback::open, media_viewer::model, the lightbox's video player) only looked in app.messages, the loaded history. The original gives these cards their own message object.
    Fix: new fluxer_core::chat::known. known::find / known::message(app, channel, message) return the loaded record first. If there is none, they return the copy listed in chat.pins, chat.search.results, the bookmarks or the recent mentions, as MessageState::Sent. The menu model, can_report_message, delete / pin / suppress / copy text / forward, the confirm's "gone" check and preview, OpenMedia, the lightbox model and its video follow this lookup. The reducers get it as a Listed view of the chat state, because ChatCtx cannot borrow chat while it is being reduced.
  2. Spoilers in pin cards could not be revealed. search::results::message_preview drew every card with empty revealed_spoilers / revealed_attachments. The click was stored in the message view's state, but the card never read it.
    Fix: CardCtx::views carries both message views. A card reads its spoilers from the view its clicks go to: the thread panel's for the panel's thread, otherwise the selected channel's.
  3. Search results, bookmarks and mentions were inert. They mapped every row event to a bare Row.
    Fix: search::Message::Row { channel_id, message_id, event } and Menu { .. }, and inbox::Message::Row { .. }, go through the routing the pins use. The routing now lives in a small screens/main/cards.rs and serves all three. A card of a channel that a view shows goes to that view (in_message_view, unchanged). A card of a channel that no view shows (a result or bookmark from elsewhere) goes to the selected view's state with the card's channel (messages::update_in). Without this, a picture of another channel would open with the wrong channel, and an author would open in the wrong community. The screen's own parts (hover, players, audio, star, author menu) take their events as they do from any row. What each surface allows matches the original:
    • Search results: the message menu on right click. A click elsewhere on the card jumps to the result (shouldSearchResultRowJump: links, buttons and pictures keep their own click).
    • Inbox: no menu (readonlyBehaviorOverrides = { disableContextMenu: true }), and a click on the card body does nothing.
  4. Right click in the thread side panel set a menu that was never drawn. The panel's Chat(Actions(..)) went to threads::panel::update → messages::update_in(&mut panel.chat, ..) and set panel.chat.actions.menu. main::message_actions_over draws only local.messages.actions. The same was true of the panel bar's "More", "Forward", "Remove all reactions" and its picker / create-thread outcomes, which were dropped.
    Fix: one route arm. The panel's message actions go to the screen's actions state, as pin cards do since #850. That state is drawn over everything, and its menu acts on the channel and message it names. Only the bar hover (BarHovered, QuickReactionHovered) stays the panel's.

Targets, before → after

Each cell is one click (or the two a spoiler needs: reveal, then open) on the main screen, through main::update and the store. "Menu" means the menu is drawn and its "Copy text" puts the message's text on the clipboard. "Picture" means OpenMedia with the card's channel, the lightbox open and its model built. For the inbox, "menu" and "blank click" are ✅ when nothing happens, as in the original. The card's message is not in the loaded history in any of these cases.

Pins popout (pin outside the loaded history for menu / picture):

Target Channel DM Group DM Thread (panel) Forum post (panel) Channel, thread panel open
right click: menu drawn ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅
menu item acts (Copy text) ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅
picture → lightbox ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅
text spoiler revealed ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅
picture spoiler revealed ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅

Search results panel (the result's channel; "another channel" is #announcements while #general is open):

Target Channel Another channel DM Thread (panel) Forum post (panel)
link ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅
author (profile, right community) ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅
text spoiler ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅
picture (spoiler, then lightbox) ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅
right click: menu, Copy text ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅
click on the card body: jump ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅

Inbox, bookmarks and mentions (same for both tabs):

Target Channel Another channel DM Thread (panel) Forum post (panel)
link ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅
author ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅
text spoiler ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅
picture (spoiler, then lightbox) ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅ ❌ → ✅
right click: no menu (as original) ✅ → ✅ ✅ → ✅ ✅ → ✅ ✅ → ✅ ✅ → ✅
click on the card body: nothing ✅ → ✅ ✅ → ✅ ✅ → ✅ ✅ → ✅ ✅ → ✅

Thread side panel:

Target Thread (panel) Forum post (panel)
right click on a row: menu drawn, Copy text ❌ → ✅ ❌ → ✅

The "before" column comes from the same probe run on origin/textchat (ec8fd146).

Tests

These are in crates/fluxer-ui/tests/pins_clicks.rs, beside #850's tests, on the same headless main screen. Every one fails on origin/textchat and passes here.

  • pin_not_loaded_has_its_menu_and_its_picture_opens (1): all six places of #850. The menu is drawn, "Copy text" copies the text of the pin that is not loaded, and the picture opens and the lightbox shows it. Before: channel: a right click opens the message's menu: None.
  • pin_spoilers_reveal (2): all six places, text spoiler then its link, picture spoiler then OpenMedia. Before: channel: once revealed, the spoiler's link opens (left []).
  • search_result_answers_like_its_message (3): channel, another channel, DM, thread and forum post in the panel. Covers the link, the author with its community, both spoilers, the lightbox, the menu with Copy text, and a click on the card body that equals search::jump. Before: channel: the link opens (left []).
  • inbox_entry_answers_like_its_message (3): the same places, bookmark and mention. Covers the content targets, no menu, and a click on the body that does nothing. Before: channel, bookmark: the link opens (left []).
  • thread_panel_message_menu_is_drawn (4): thread and forum post. The menu is drawn, it is the row's, and Copy text copies the row's text. Before: thread in the side panel: the menu is drawn.

No golden changed: nothing renders differently until a click.

Gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci passed locally (==> xtask ci: all steps passed, at b9f64fe4).

Edits to files shared with the shell work: screens/main/mod.rs gets mod cards, attachment_event split out of attachment_message (body unchanged), the card arms (which replace #850's pin arms), one arm for the panel's actions, and views in card_ctx. fluxer-ui's app.rs is untouched. In fluxer-core, app.rs only passes the listed messages to video.follow_view.

Not changed here (separate issue suggested): on a card whose message is not loaded, the menu offers Reply, Edit, reactions, "Mark as unread" and "Create thread". Their reducers (composer StartReply/StartEdit, reactions::toggle, mark_unread) still need the loaded record, so those items do nothing there.

🤖 Generated with Claude Code

Closes #849 Follow-up of #850. All four items of #849 are in this PR. Each one was driven headlessly on the real main screen (iced widget protocol, software renderer, 1600 × 900, the `textchat` READY), clicked through `main::update` and the store, and compared with the original (`ChannelPinsContent.tsx`, `ChannelSearchResults.tsx` + `SearchResultRowClick.ts` + `ChannelSearchResultsShared.tsx`, `SavedMessagesContent.tsx`, `RecentMentionsContent.tsx`, `UserMessage.tsx`). ## Causes and fixes 1. **A pin that is not loaded had no menu, and its picture did not open.** The message menu (`chat::actions::message_actions`), the actions it sends (`sent`/`record` in `chat/actions.rs`) and the lightbox (`MediaPlayback::open`, `media_viewer::model`, the lightbox's video player) only looked in `app.messages`, the loaded history. The original gives these cards their own message object. *Fix:* new `fluxer_core::chat::known`. `known::find` / `known::message(app, channel, message)` return the loaded record first. If there is none, they return the copy listed in `chat.pins`, `chat.search.results`, the bookmarks or the recent mentions, as `MessageState::Sent`. The menu model, `can_report_message`, delete / pin / suppress / copy text / forward, the confirm's "gone" check and preview, `OpenMedia`, the lightbox model and its video follow this lookup. The reducers get it as a `Listed` view of the chat state, because `ChatCtx` cannot borrow `chat` while it is being reduced. 2. **Spoilers in pin cards could not be revealed.** `search::results::message_preview` drew every card with empty `revealed_spoilers` / `revealed_attachments`. The click was stored in the message view's state, but the card never read it. *Fix:* `CardCtx::views` carries both message views. A card reads its spoilers from the view its clicks go to: the thread panel's for the panel's thread, otherwise the selected channel's. 3. **Search results, bookmarks and mentions were inert.** They mapped every row event to a bare `Row`. *Fix:* `search::Message::Row { channel_id, message_id, event }` and `Menu { .. }`, and `inbox::Message::Row { .. }`, go through the routing the pins use. The routing now lives in a small `screens/main/cards.rs` and serves all three. A card of a channel that a view shows goes to that view (`in_message_view`, unchanged). A card of a channel that no view shows (a result or bookmark from elsewhere) goes to the selected view's state with the card's channel (`messages::update_in`). Without this, a picture of another channel would open with the wrong channel, and an author would open in the wrong community. The screen's own parts (hover, players, audio, star, author menu) take their events as they do from any row. What each surface allows matches the original: - Search results: the message menu on right click. A click elsewhere on the card jumps to the result (`shouldSearchResultRowJump`: links, buttons and pictures keep their own click). - Inbox: no menu (`readonlyBehaviorOverrides = { disableContextMenu: true }`), and a click on the card body does nothing. 4. **Right click in the thread side panel set a menu that was never drawn.** The panel's `Chat(Actions(..))` went to `threads::panel::update` → `messages::update_in(&mut panel.chat, ..)` and set `panel.chat.actions.menu`. `main::message_actions_over` draws only `local.messages.actions`. The same was true of the panel bar's "More", "Forward", "Remove all reactions" and its picker / create-thread outcomes, which were dropped. *Fix:* one `route` arm. The panel's message actions go to the screen's actions state, as pin cards do since #850. That state is drawn over everything, and its menu acts on the channel and message it names. Only the bar hover (`BarHovered`, `QuickReactionHovered`) stays the panel's. ## Targets, before → after Each cell is one click (or the two a spoiler needs: reveal, then open) on the main screen, through `main::update` and the store. "Menu" means the menu is drawn and its "Copy text" puts the message's text on the clipboard. "Picture" means `OpenMedia` with the card's channel, the lightbox open and its model built. For the inbox, "menu" and "blank click" are ✅ when nothing happens, as in the original. The card's message is not in the loaded history in any of these cases. **Pins popout** (pin outside the loaded history for menu / picture): | Target | Channel | DM | Group DM | Thread (panel) | Forum post (panel) | Channel, thread panel open | |---|---|---|---|---|---|---| | right click: menu drawn | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | | menu item acts (Copy text) | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | | picture → lightbox | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | | text spoiler revealed | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | | picture spoiler revealed | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | **Search results panel** (the result's channel; "another channel" is #announcements while #general is open): | Target | Channel | Another channel | DM | Thread (panel) | Forum post (panel) | |---|---|---|---|---|---| | link | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | | author (profile, right community) | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | | text spoiler | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | | picture (spoiler, then lightbox) | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | | right click: menu, Copy text | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | | click on the card body: jump | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | **Inbox, bookmarks and mentions** (same for both tabs): | Target | Channel | Another channel | DM | Thread (panel) | Forum post (panel) | |---|---|---|---|---|---| | link | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | | author | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | | text spoiler | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | | picture (spoiler, then lightbox) | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | ❌ → ✅ | | right click: no menu (as original) | ✅ → ✅ | ✅ → ✅ | ✅ → ✅ | ✅ → ✅ | ✅ → ✅ | | click on the card body: nothing | ✅ → ✅ | ✅ → ✅ | ✅ → ✅ | ✅ → ✅ | ✅ → ✅ | **Thread side panel:** | Target | Thread (panel) | Forum post (panel) | |---|---|---| | right click on a row: menu drawn, Copy text | ❌ → ✅ | ❌ → ✅ | The "before" column comes from the same probe run on `origin/textchat` (ec8fd146). ## Tests These are in `crates/fluxer-ui/tests/pins_clicks.rs`, beside #850's tests, on the same headless main screen. Every one fails on `origin/textchat` and passes here. - `pin_not_loaded_has_its_menu_and_its_picture_opens` (1): all six places of #850. The menu is drawn, "Copy text" copies the text of the pin that is not loaded, and the picture opens and the lightbox shows it. Before: `channel: a right click opens the message's menu: None`. - `pin_spoilers_reveal` (2): all six places, text spoiler then its link, picture spoiler then `OpenMedia`. Before: `channel: once revealed, the spoiler's link opens` (left `[]`). - `search_result_answers_like_its_message` (3): channel, another channel, DM, thread and forum post in the panel. Covers the link, the author with its community, both spoilers, the lightbox, the menu with Copy text, and a click on the card body that equals `search::jump`. Before: `channel: the link opens` (left `[]`). - `inbox_entry_answers_like_its_message` (3): the same places, bookmark and mention. Covers the content targets, no menu, and a click on the body that does nothing. Before: `channel, bookmark: the link opens` (left `[]`). - `thread_panel_message_menu_is_drawn` (4): thread and forum post. The menu is drawn, it is the row's, and Copy text copies the row's text. Before: `thread in the side panel: the menu is drawn`. No golden changed: nothing renders differently until a click. Gate: `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` passed locally (`==> xtask ci: all steps passed`, at b9f64fe4). Edits to files shared with the `shell` work: `screens/main/mod.rs` gets `mod cards`, `attachment_event` split out of `attachment_message` (body unchanged), the card arms (which replace #850's pin arms), one arm for the panel's actions, and `views` in `card_ctx`. `fluxer-ui`'s `app.rs` is untouched. In `fluxer-core`, `app.rs` only passes the listed messages to `video.follow_view`. Not changed here (separate issue suggested): on a card whose message is not loaded, the menu offers Reply, Edit, reactions, "Mark as unread" and "Create thread". Their reducers (`composer` StartReply/StartEdit, `reactions::toggle`, `mark_unread`) still need the loaded record, so those items do nothing there. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
- fluxer-core: chat::known finds a message loaded or listed (pins, search
  results, bookmarks, mentions); the message menu, its actions and the
  lightbox use it, so a pin outside the loaded history has its menu and
  its pictures open.
- Cards read their spoilers from the message view their clicks go to.
- Search results and inbox entries route their row events like the pins
  (screens/main/cards.rs); a search result also has the message menu and
  jumps on a click on its body; the inbox has no menu, as the original.
- The thread side panel's message actions go to the screen's actions
  state, which is drawn (the panel's menu was set and never drawn).
- Headless tests in tests/pins_clicks.rs for all four, each failing on
  origin/textchat.

Closes #849

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

Merged into textchat by hand (the merge API returns 405); the commits are in the branch.

Merged into `textchat` by hand (the merge API returns 405); the commits are in the branch.
charles closed this pull request 2026-11-18 04:18:42 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.