Skip to content

The desktop app pins, archives, mutes, blocks, deletes and exports chats, and answers requests - #200

Merged
pitis merged 3 commits into
mainfrom
feat/desktop-chat-actions
Nov 14, 2026
Merged

pitis merged 3 commits into
mainfrom
feat/desktop-chat-actions

Conversation

@pitis

@pitis pitis commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

What changed

A chat row's right-click menu (core/desktop/src/app/chats.rs, drawn in chats/view.rs), as the Mac app's SidebarView.chatMenu, in its order:

  • Pin chat / Unpin chat. Pin is greyed out once 4 chats are pinned (the core refuses a fifth).
  • Mute notifications ▸ 1 hour, 8 hours, 1 day, 1 week, Always. Unmute notifications when the chat is muted.
  • Mark as read / Mark as unread. Marking the open chat unread closes it, as on the Mac and Desktop, so it isn't read again at once.
  • Export chat…: a folder picker, then export_chat into a new folder there, then the new folder opens in the file manager (through the app's own opener: a failure is said, and nothing is logged). The exported files get the same "from elsewhere" mark that opened files get (Gatekeeper's quarantine on macOS, the Mark of the Web on Windows), as the Mac app does (Files.quarantineFiles).
  • A separator, then Archive chat / Unarchive chat, and Block… / Unblock. Block isn't offered for Note to Self. Block… asks first, with the Mac's wording.
  • The menu reads the chat when it opens, so it never offers something that went stale since the last redraw (an ended mute, say).
  • Flag changes run one after the other, so two quick ones land in order (AppStore.change). A failure shows in the error banner ("Couldn't pin the chat: …").

The request bar replaces the "answer on your phone" shortcut:. It stands in place of the composer, with the Mac's RequestBar text and buttons; Accept, Unblock and Join look like the default (a join request's bar has none):

  • message request: Block, Delete, Accept
  • group invitation: Block, Decline, Join (change_group AcceptInvitation / DeclineInvitation; declining also deletes the chat)
  • our join request: Delete, Cancel Request
  • blocked chat: Delete, Unblock

Block, Delete, Decline and Cancel Request ask first, with the Mac's questions ("this Mac" becomes "this computer"). While a Join, Decline or Cancel Request is with the server, all the bar's buttons wait (a Delete meanwhile would delete the chat twice). Return doesn't press the default button as on the Mac (shortcut:).

Archived chats: archived chats used to be hidden. An "Archived Chats" row with its count now sits under the inbox (when any chat is archived and nothing is being searched). It opens the archive: an "Archived" list, with a back button in New Chat's place. An archive that empties closes, as on the Mac. The arrows and ⌘1–9 move through what is listed. A search still covers every chat, and the archive comes back when the search ends. Archived chats' pictures and group authors' names now load too.

Smaller changes

  • sig-core: re-exports GroupChange (pub use groups::{GroupChange, GroupPreview}). change_group was public but its argument's type couldn't be named outside the crate. The Swift bindings don't change.
  • The cancelling flag is renamed answering; it now covers invitations too.
  • files::mark_from_elsewhere is now pub(super) so the export can use it.
  • Snapshot screens: chat-menu (Ana's row right-clicked), request (a message request open), archive.

As on the Mac, an accepted chat has no Delete; Delete is in the request bar only (the issue's list puts Delete in the row menu, but the Mac's row menu doesn't have one).

Why

Closes #143. Part of the desktop parity epic.

How it was tested

  • make format; make lint (rustfmt check, cargo clippy --all-targets -- -D warnings, swift-format lint); cargo clippy -p hush-desktop --all-targets --features snapshot -- -D warnings.
  • cd core && cargo test -q: desktop 114, sig-core 537 (3 ignored), all pass. cargo test -p hush-desktop --features snapshot: 154 pass, including the new window tests.
  • The Swift leg, because sig-core changed: make core, make project, then the unsigned xcodebuild … test CODE_SIGNING_ALLOWED=NO CODE_SIGN_IDENTITY="". All pass but two, which fail again when re-run alone and don't touch the core: LegacyTests.testSettingsAreAdoptedWithoutOverwritingNewOnes (UserDefaults.persistentDomain(forName:) returns [:], not nil, after the domain is removed, on this macOS) and MessageRowTests.testRightClickOnTextClickedIntoShowsTheMessageMenu (no NSTextField found on screen). The regenerated Swift bindings match the main checkout's, except for listGroup from a newer main commit: the re-export doesn't change them.
  • New unit tests:
    • the menu's items for each state of a chat: pinned or not, the pin limit, muted or an ended mute, unread or marked unread, archived, blocked, Note to Self
    • the mute options and when each one ends
    • the bar's buttons and text for a message request (person and group), an invitation, a join request, and a blocked chat (blocked wins)
    • which answers ask first, and their questions
    • an export's files get the quarantine mark
    • listed with the archive
  • New window tests (headless GPUI window; the last two against a real, unlinked core, whose refusals show that a change was asked for):
    • the archive lists only archived chats, ⌥↓ moves through it, a search covers every chat, and the archive comes back after the search
    • an archive that empties closes
    • Mark as unread closes the open chat only
    • Delete and Block ask first, with the right question, and go ahead only on yes (Cancel keeps the chat; Delete closes it); Accept doesn't ask
    • each menu item reaches the core with its own failure message
  • The shared test helper with_core now never drops its core: a database still closing as the test binary exited crashed it (SIGSEGV after test result: ok, 3 of 12 runs of the core-backed tests; 0 of 12 with the fix).
  • Each new test failed before its code: checked by stubbing the logic, the archive filter, the close, the archive closing and the confirmation's yes/cancel.
  • Snapshots, light and dark: chat-menu, request and archive, checked against the Mac's chatMenu, RequestBar and archiveRow. Also the chat screen (with the new Archived Chats row).

Not tested: the live window and a linked phone. With no core in the demo and tests, the core calls themselves (pin, mute, block, export, join…) aren't run from the desktop. They are the Mac app's calls, covered by sig-core's tests. Also not tested: the native folder picker and the file manager reveal, and the Mute submenu (it opens on hover, which the snapshot doesn't do).

…ats, and answers requests

A chat row's right-click menu has the Mac app's chat actions: pin (four at most), mute for a
while or for good, mark read or unread, export, archive, block (asking first). The bar in place
of the composer answers a message request, an invitation or our join request, or unblocks; the
destructive answers ask first. Archived chats get their own list behind an "Archived Chats" row.

sig-core re-exports GroupChange: change_group was public but its argument couldn't be named.
…ports open without logging

- The request bar's buttons all wait while an answer is with the server: a Delete during a
  Cancel Request or Decline deleted the chat twice and said it failed.
- An archive that empties closes, as on the Mac. The empty pane checks every chat, archived
  ones too.
- The exported folder opens through the app's own opener: GPUI's reveal said nothing on failure
  and logged the path (the chat's name) on Windows. A non-local folder is said.
- Only Accept, Unblock and Join look like the default (a join request's bar has none). A failed
  Unblock says so.
- The change line holds a plain task. Comments fixed where wrong or stale.
- Window tests run against a real, unlinked core, so going ahead (or not) shows; the test core
  is never dropped, as a database closing at exit crashed the test binary.
@pitis

pitis commented Nov 14, 2026

Copy link
Copy Markdown
Owner Author

Review (/pr-review-toolkit:review-pr: code, errors, tests, comments, types)

Fixed in 1faf26b. Gate after the fixes: make format, make lint, snapshot-feature clippy, cd core && cargo test -q (desktop 114, sig-core 537), cargo test -p hush-desktop --features snapshot (154). No sig-core change since the first commit, so the Swift leg wasn't re-run.

Critical

  • tests: the confirmation test couldn't tell Cancel from yes, because the demo had no core. Fixed: the window tests now run against a real, unlinked core (the existing with_core helper). Its refusals show what was asked. Cancel keeps the chat; Delete closes it and reaches the core; Block reaches the core. Checked by flipping the answer index: the test fails.

Important

  • types: while a Cancel Request or Decline was with the server, Delete and Block stayed clickable. A Delete meanwhile deleted the chat twice and showed a false "Couldn't delete the chat". This was a regression from main's bar. Fixed: every bar button waits while answering; waits() is gone.
  • tests: an archive that empties stayed open, showing an empty "Archived" list. The Mac closes it (AppStore.conversations didSet). Fixed in set_chats, with a test that fails without it.
  • tests: the menu's routing and its failure messages were unasserted. Fixed: a test picks each item against the core and checks its own message.
  • errors: the export's GPUI reveal_path said nothing when it failed, and on Windows logged the folder path, which is named after the chat. Fixed: the folder opens through files::launch, the app's own opener (a failure is said, nothing is logged). It opens the folder rather than selecting it in its parent.
  • code: with every chat archived, the empty pane said "Connected — no messages yet". Fixed: it checks all chats; inbox() had no callers left and is gone.
  • comments: Mark as unread's reason was copied from the Mac and is false here; the demo's "only a search shows it" was stale. Fixed.

Suggestions taken

  • A join request's Cancel Request no longer looks like the default button; only Accept, Unblock and Join do, as on the Mac. Return pressing the default is a shortcut: note.
  • A failed Unblock says "Couldn't unblock the chat".
  • A folder the picker can't give as a local path is said, not dropped silently.
  • ChatActions.last holds a plain Task (no Shared).
  • Comment wording: pin "greyed out"; the join request's Delete reason restored; Back's place; right_click_ana's strip; MAX_PINNED's core twin; the archive flag vs. search.
  • A shortcut: note on change: Delete doesn't wait in its line, and a later success doesn't clear an earlier failure (the Mac does both).

Found while fixing

  • The core-backed tests crashed the test binary at exit, about 1 run in 4 (SIGSEGV after test result: ok). This is the database-closing-at-exit problem, which the core's own tests handle since main's last commit. It also affected the two existing attach tests. Fixed: with_core never drops its core. 0 of 12 runs crash, against 3 of 12 without it.

Declined, with reason

  • Logging change failures (errors): the desktop's other flows (delete_chat, mark_read, saving files) don't log them either. Noted in the shortcut: on change.
  • One app-wide answering flag (code, types): a Join in one chat greys another chat's bar for one round trip. This is main's behaviour (cancelling), and a per-chat flag costs more code than the brief overlap is worth.
  • Keyboard access to the row menu (code): none exists for any desktop menu yet. That belongs with a keyboard pass over the whole app, not this issue.
  • reveal_chat duplicating the sidebar's title count (tests): both agree in every case (checked). Merging them is a refactor outside this issue.
  • change_group(AcceptInvitation) saying "Couldn't join" when only the local accept fails (errors): this is core behaviour, the same on the Mac and out of scope here.

@pitis

pitis commented Nov 14, 2026

Copy link
Copy Markdown
Owner Author

Updated with main (#199, desktop drafts) through make update: the merge applied cleanly with no conflicts (2bcd877). Re-ran after it: make format, make lint, snapshot-feature clippy, cd core && cargo test -q (desktop 117, sig-core 537), cargo test -p hush-desktop --features snapshot (159). Snapshots re-rendered: chat-menu, archive and request still draw as before beside the drafts 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 pins, archives, mutes, blocks, deletes and exports chats, and answers requests

1 participant