Skip to content

The desktop app replies to, reacts to, edits, copies and deletes messages - #180

Merged
pitis merged 4 commits into
mainfrom
feat/desktop-message-actions
Nov 14, 2026
Merged

pitis merged 4 commits into
mainfrom
feat/desktop-message-actions

Conversation

@pitis

@pitis pitis commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

What changed

The desktop app (core/desktop) now does what the Mac app's MessageActions.swift / MessageRow / ComposerView do with a message:

  • Hover buttons beside a bubble: React, Reply, More (React nearest the bubble, mirrored for our own messages), not on deleted messages. They stay shown while the reaction picker is open.
  • Right-click menu (and the More button's): React ▸ (Signal's six reactions, ours marked "✓"), Reply, Edit, Copy, Retry, Delete for Everyone…, offered by the Mac app's rules.
  • Reactions: the pill under a bubble (each emoji once with its count, most first, ours tinted; half over the bubble's edge); a click shows who reacted, with Remove for ours. Choosing our reaction again takes it back. A reaction just sent counts until the loaded reactions show it (the Mac app's pendingReactions); Remove in the list always takes ours back.
  • Quoted replies inside a bubble ("Reply" when the author quotes themselves, else "Quoted"; "Attachment" without text).
  • Reply and edit bars above the composer ("Replying to …" / "Replying to yourself", "Editing message"), with ✕ or Esc to drop them. Sending replies with the quote; while editing, the send button is "Save edit" and sending saves the edit. What was typed before editing comes back after the edit is saved or cancelled. ↑ in the empty composer edits our newest editable message. A reply to or an edit of a message deleted for everyone or disappeared ends (an ended edit says so).
  • Retry: a failed message's tick is a "Retry" button, as on the Mac.
  • Delete for Everyone asks first ("Delete this message for everyone?" / "Everyone in this chat sees that you deleted it.") with GPUI's window prompt (a native dialog on macOS and Windows, GPUI's own on Linux).
  • Selecting and copying message text: message text can be selected with the mouse and copied with ⌘C / Ctrl+C. Copy in the menu copies the whole text with mentions as "@name" and spoilers shown.

The rules (which messages can be edited or deleted, for how long, story replies not editable) are the Mac app's, as pure functions in app/actions/mod.rs. "edited" in the meta was already shown.

Code: logic and state in core/desktop/src/app/actions/mod.rs, drawing in core/desktop/src/app/actions/view.rs; app/mod.rs and app/view.rs only hook it in (the bubble became a column so the quote sits above its text). No core change, no new dependency.

Why

Part of desktop parity: these are the everyday message actions the Mac app has.

Decisions to look at

  • Editing is offered only for plain text. The Mac app lets an edit through when its composer can hold the message's mentions (and its composer holds styles). This composer holds neither, so a message with any mention or style isn't offered for editing: the edit would silently drop them (shortcut: comment in can_edit). Delete for Everyone is still offered.
  • No "More reactions" (any emoji). The Mac app's + opens macOS's character palette; GPUI has nothing cross-platform for that. The six quick reactions are there.
  • No "Delete for me". Neither the Mac app nor the core has it, only Delete for Everyone.
  • Reactions are read with Client::details once per reload of the open chat (the page's 100 messages, one call; reloads while one runs fold into one more). The files issue (The desktop app shows pictures, videos, voice messages and files in chats #136) will likely read the same call for attachments; one of the two should then reuse the other's load.

How it was tested

  • cargo fmt --check; cargo clippy -p hush-desktop --all-targets -- -D warnings, and with --features snapshot; cargo test -p hush-desktop (35 pass). The full make check needs the signing certificate this Mac lacks.
  • New unit tests for the rules: which items a message's menu offers (theirs, ours, pending, failed, deleted, a day old, story reply, mentions/styles, files), the 24-hour window's edge, ↑'s newest editable message, the pill's counts/order/ours, and choosing our reaction again taking it back. Breaking each rule (the window's <=, the story check, the pill's sort) makes them fail.
  • --snapshot, light and dark: the chat shows a quoted reply ("Quoted / @you can you bring the big pot?"), reaction pills (❤️ 2 ours tinted, 🎉; 👍 under our own bubble), "edited", and a failed message's "⚠ Retry". A new "reply" screen shows the reply bar ("Replying to Bogdan Ionescu / Traffic is terrible today") and the hover buttons and the open reaction picker beside the message it answers; a temporary render also checked them beside an outgoing bubble (More, Reply, React).

Not verified (menus don't render offscreen, and the desktop app was never linked or run live): the context menu, the More menu and the reactors popover opening, the delete prompt, hovering, selecting text and ⌘C/Ctrl+C, Esc and ↑, and sends to a real chat (react, reply, edit, delete, retry). Their logic is in the unit tests; their wiring is GPUI's / gpui-component's own components.

Closes #138
Part of #157

… ends with its message, popups follow their message, clicks keep the composer's focus
@pitis

pitis commented Nov 14, 2026

Copy link
Copy Markdown
Owner Author

Review findings and their fixes (commit 9a4189f). Checks: cargo fmt --check, cargo clippy -p hush-desktop --all-targets -- -D warnings (and --features snapshot), cargo test -p hush-desktop (35 pass, 3 new), --snapshot light and dark.

Important

  1. Remove in the who-reacted list could add the reaction back; a pending reaction was dropped by any later load. Fixed. react is now a wrapper: it decides add or take back and calls the new send_reaction(m, emoji, remove, cx). Remove calls send_reaction(.., remove = true), so it always takes back. Pending reactions now stay until the loaded reactions show them (settle). A reload that comes earlier, for example one started by a read receipt, keeps them. The core records our reaction whether or not the send went out (record_mutation), so a pending reaction always settles. New test: a_reaction_just_sent_counts_until_the_loaded_ones_show_it (failed against the old rule).
  2. The reply and edit bars outlived a deleted or expired message, and the reply re-sent its text as the quote. Fixed.
    • On each reload, a reply ends when its message is in the loaded page and marked deleted (gone). A message older than the page doesn't count as gone.
    • An edit ends in the same case.
    • On MessageExpired, handle calls message_expired(key), which ends a reply to that key or an edit of it.
    • An edit that ends this way shows "The message you were editing was deleted or disappeared, so the edit wasn't sent." The draft typed before the edit comes back (deferred, since it needs the window).
    • New test: a_reply_or_edit_ends_when_its_message_is_deleted_not_when_older_than_the_page.
  3. Popovers and the text selection were keyed by row index. Fixed. A row's id is now its message (author:sent_at), and the ids inside it are constant (react, reactors, text, pill, retry, the buttons). An open picker, list or selection now stays with its message when new messages arrive. The picker is also controlled by picking now, so the two can't get out of step (see 10).
  4. Tracking focus on the whole chat pane made clicks steal the composer's focus. Fixed. Esc is still handled on the pane, but the focus handle is now on a zero-size child. ✕, Retry, the pill and clicks on bubbles leave the composer focused. Selecting message text still moves the keyboard to that handle, so ⌘C/Ctrl+C reach Root's copy and Esc still works.
  5. Names of people mentioned in a quote were never loaded. Fixed. set_messages now also asks for the names mentioned in m.quote's ranges. Reactors' names are loaded too, when the reactions change.

Suggestions

  1. Coalescing reaction loads. Done. Calls made while a load runs fold into one more, the same as reload_messages. Each run reads the current page's keys, and a load for a chat that is no longer open is dropped (generation).
  2. Clones on every render. Done. RowActions no longer holds the Message or the Copy text. Clicks look the message up by key at click time, and Copy builds its text in the click handler.
  3. ↑ skipping a newer styled message. Done. ↑ takes the newest of our messages the Mac app would edit (editable, the Mac app's rule including holdable mentions). If this composer can't edit it, ↑ does nothing; it doesn't edit an older one. New test: up_does_nothing_when_this_composer_cant_edit_the_newest.
  4. Lost text after a failed edit or reply.
    • Edit: done. The composer keeps the edit's text until the core takes it, and a second ↩ meanwhile doesn't send it twice. A failure shows "Couldn't edit the message: …" and leaves the text in place. Pressing Esc or switching chats during the save is cancelling the edit, as on the Mac.
    • Reply: when a failed reply's text goes back to another chat's draft, the error now says so: "Couldn't send the reply: …. Its text is back in its chat, without the quote."
    • Not changed here, but worth knowing: in that same failure path, drafts.entry(id).or_insert(body) keeps an existing draft and drops the failed text. That predates this PR (send), so I left it alone.
  5. The picker left picking set after scrolling off screen. Done. The picker popover is controlled by .open(row.picking) plus on_open_change. A picker whose row scrolls away and back shows again, and the state can't go stale. Side effect: the open picker now renders in the "reply" snapshot, and it looks right (the six reactions above the React button).

Rulings applied, no change: editing stays plain-text only (the shortcut: comment in can_edit points to lifting it); no "More reactions" palette; no Delete for me. No Swift changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The desktop app replies to, reacts to, edits, copies and deletes messages

1 participant