Copy IDs: toasts for the DM menu, status popout and message copies (#597) #639

Merged
charles merged 1 commit from fix/597-copy-id into textchat 2026-11-15 12:53:32 +00:00
Owner

Closes #597

Cause

#597 was filed on 890f6d8. At that commit nothing handled UserAction::CopyId. Daily use 17 (6db33abf, feat(core): channel, category and guild menus) has since landed on textchat, and with it fluxer-core/src/menus/channel.rs::reduce, called from app.rs:316. That reducer matches CopyId(_, id) for every IdKind, so on textchat all the "Copy … ID" rows already put the right text on the clipboard. The new tests below show this: they pass on the unchanged base for every surface, through to the runtime's text clipboard.

The real gap on textchat was the confirmation. Two CopyId surfaces did not show the toast the original shows:

  • DM menu "Copy user ID": menus::pick (fluxer-ui/src/screens/main/menus/mod.rs) only asked channel::toast and guild::toast, and neither knows copy-user-id. The original toasts "User ID copied" (DMMenuData.tsx:497-505). The user and member menus' "Copy user ID" correctly has no toast (CopyUserIdMenuItem, suppressToast = true).
  • Status popout "Copy user ID": it only sent CopyId. The original calls TextCopyCommands.copy(i18n, currentUserId), which toasts "Copied to clipboard" (UserAreaPopout.tsx:447-452).

Also fixed while auditing: a message's Copy text / Copy message link / Copy message ID copied correctly but showed no toast, while the original's MessageActionUtils.tsx:545-572 (TextCopyCommands.copy) shows "Copied to clipboard".

Fix

It follows the existing pattern: the store answers with Effect::Clipboard(ClipboardWrite::Text), and the UI owns the toast on menus::State.

  • menus::dm::toast(target, item): "User ID copied" for the DM menu's copy-user-id. "Channel ID copied" still comes from channel::toast, which matches DMMenuData.tsx:489-496.
  • menus::State::show_toast(text): the same toast, clock and timer as the copy rows.
  • main::update: the status popout's CopyUserId and any UserAction::CopyMessage put up "Copied to clipboard" (menus::guild::COPIED_TO_CLIPBOARD).
  • READMEs: fluxer-core now says that CopyId covers every IdKind, including the user, DM and status-popout rows. fluxer-ui documents the new toasts.

There is no change to fluxer-core's code, and no new I/O path.

Copy actions

Surface Row Text copied Clipboard before Toast (original) Status
Channel menu Copy channel ID id worked "Channel ID copied" worked
Channel menu Copy channel link {webapp}/channels/{guild}/{channel} worked "Channel link copied" worked
Link channel menu Copy link the URL worked (core test) "Link copied to clipboard" worked
Category menu Copy category ID id worked "Category ID copied" worked
Guild menu Copy community ID id worked "Copied to clipboard" worked
User menu: member list / author / mention (also self) Copy user ID id worked none worked
DM menu Copy user ID recipient id worked "User ID copied" toast fixed
DM / group DM menu Copy channel ID id worked "Channel ID copied" worked
Status popout Copy user ID own id worked "Copied to clipboard" toast fixed
Message bar / menu Copy text effective content worked "Copied to clipboard" toast fixed
Message bar / menu Copy message link {webapp}/channels/{guild|@me}/{channel}/{message} worked "Copied to clipboard" toast fixed
Message bar / menu Copy message ID (Shift: {channel}-{message}) id / pair worked "Copied to clipboard" toast fixed
Forum post Copy post link {webapp}/channels/{guild}/{post} worked "Post link copied" worked
Thread menu Copy link / Copy thread ID link / id (shell writes) worked not checkable (fork source not in the reference) worked
Invite modal Copy {invite}/{code} worked (core test) "Copied" label worked (label stays until the link changes, a documented divergence)
Lightbox Copy link the file's URL (originalSrc) worked "Link copied to clipboard" copies; toast missing → #638
Lightbox / attachment Copy media PNG (URL fallback) worked (dailyuse_runtime) original's toasts worked
Keybind Ctrl+Shift+L Copy channel link channel link worked (keynav test) "Copied to clipboard" copies; toast missing → #638
Settings client info, status API URL, blocked users' Copy username / Copy user ID as shown worked (existing tests) "Copied" hint / none worked
Voice details endpoint endpoint worked none worked
Voice participant menu, profile popout / modal copy rows n/a not built (left out by spec) n/a n/a

Tests

  • crates/fluxer-ui/tests/copy_actions.rs (new): every menu copy row (channel, category, guild, member, author, mention, self, DM, group DM), the status popout, the four message copies, the forum post link and the thread menu (a headless click). Each test goes UI message → UserAction → App::apply → clipboard text, plus the toast. Before the fix, two of them failed on the toast (DM "Copy user ID", status popout); the text assertions passed.
  • crates/fluxer-ui/tests/attachment_actions.rs: the lightbox's "Copy link" carries the attachment's own URL.
  • apps/fluxer/tests/dailyuse_runtime.rs::copy_ids_reach_text_clipboard: CopyId for a user, a channel, a group DM and a guild, through the real runtime, to desktop_rt's TextClipboard (fake).
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci is green locally.

Not verified: the real system clipboard on Wayland, X11 and Windows. The last hop is iced's clipboard::write, unchanged here.

🤖 Generated with Claude Code

Closes #597 ## Cause #597 was filed on 890f6d8. At that commit nothing handled `UserAction::CopyId`. Daily use 17 (6db33abf, `feat(core): channel, category and guild menus`) has since landed on `textchat`, and with it `fluxer-core/src/menus/channel.rs::reduce`, called from `app.rs:316`. That reducer matches `CopyId(_, id)` for **every** `IdKind`, so on `textchat` all the "Copy … ID" rows already put the right text on the clipboard. The new tests below show this: they pass on the unchanged base for every surface, through to the runtime's text clipboard. The real gap on `textchat` was the confirmation. Two `CopyId` surfaces did not show the toast the original shows: - **DM menu "Copy user ID"**: `menus::pick` (`fluxer-ui/src/screens/main/menus/mod.rs`) only asked `channel::toast` and `guild::toast`, and neither knows `copy-user-id`. The original toasts "User ID copied" (`DMMenuData.tsx:497-505`). The user and member menus' "Copy user ID" correctly has no toast (`CopyUserIdMenuItem`, `suppressToast = true`). - **Status popout "Copy user ID"**: it only sent `CopyId`. The original calls `TextCopyCommands.copy(i18n, currentUserId)`, which toasts "Copied to clipboard" (`UserAreaPopout.tsx:447-452`). Also fixed while auditing: a message's **Copy text / Copy message link / Copy message ID** copied correctly but showed no toast, while the original's `MessageActionUtils.tsx:545-572` (`TextCopyCommands.copy`) shows "Copied to clipboard". ## Fix It follows the existing pattern: the store answers with `Effect::Clipboard(ClipboardWrite::Text)`, and the UI owns the toast on `menus::State`. - `menus::dm::toast(target, item)`: "User ID copied" for the DM menu's `copy-user-id`. "Channel ID copied" still comes from `channel::toast`, which matches `DMMenuData.tsx:489-496`. - `menus::State::show_toast(text)`: the same toast, clock and timer as the copy rows. - `main::update`: the status popout's `CopyUserId` and any `UserAction::CopyMessage` put up "Copied to clipboard" (`menus::guild::COPIED_TO_CLIPBOARD`). - READMEs: `fluxer-core` now says that `CopyId` covers every `IdKind`, including the user, DM and status-popout rows. `fluxer-ui` documents the new toasts. There is no change to `fluxer-core`'s code, and no new I/O path. ## Copy actions | Surface | Row | Text copied | Clipboard before | Toast (original) | Status | |---|---|---|---|---|---| | Channel menu | Copy channel ID | id | worked | "Channel ID copied" | worked | | Channel menu | Copy channel link | `{webapp}/channels/{guild}/{channel}` | worked | "Channel link copied" | worked | | Link channel menu | Copy link | the URL | worked (core test) | "Link copied to clipboard" | worked | | Category menu | Copy category ID | id | worked | "Category ID copied" | worked | | Guild menu | Copy community ID | id | worked | "Copied to clipboard" | worked | | User menu: member list / author / mention (also self) | Copy user ID | id | worked | none | worked | | DM menu | Copy user ID | recipient id | worked | "User ID copied" | **toast fixed** | | DM / group DM menu | Copy channel ID | id | worked | "Channel ID copied" | worked | | Status popout | Copy user ID | own id | worked | "Copied to clipboard" | **toast fixed** | | Message bar / menu | Copy text | effective content | worked | "Copied to clipboard" | **toast fixed** | | Message bar / menu | Copy message link | `{webapp}/channels/{guild\|@me}/{channel}/{message}` | worked | "Copied to clipboard" | **toast fixed** | | Message bar / menu | Copy message ID (Shift: `{channel}-{message}`) | id / pair | worked | "Copied to clipboard" | **toast fixed** | | Forum post | Copy post link | `{webapp}/channels/{guild}/{post}` | worked | "Post link copied" | worked | | Thread menu | Copy link / Copy thread ID | link / id (shell writes) | worked | not checkable (fork source not in the reference) | worked | | Invite modal | Copy | `{invite}/{code}` | worked (core test) | "Copied" label | worked (label stays until the link changes, a documented divergence) | | Lightbox | Copy link | the file's URL (`originalSrc`) | worked | "Link copied to clipboard" | copies; **toast missing → #638** | | Lightbox / attachment | Copy media | PNG (URL fallback) | worked (`dailyuse_runtime`) | original's toasts | worked | | Keybind Ctrl+Shift+L | Copy channel link | channel link | worked (keynav test) | "Copied to clipboard" | copies; **toast missing → #638** | | Settings | client info, status API URL, blocked users' Copy username / Copy user ID | as shown | worked (existing tests) | "Copied" hint / none | worked | | Voice details | endpoint | endpoint | worked | none | worked | | Voice participant menu, profile popout / modal | copy rows | n/a | not built (left out by spec) | n/a | n/a | ## Tests - `crates/fluxer-ui/tests/copy_actions.rs` (new): every menu copy row (channel, category, guild, member, author, mention, self, DM, group DM), the status popout, the four message copies, the forum post link and the thread menu (a headless click). Each test goes UI message → `UserAction` → `App::apply` → clipboard text, plus the toast. Before the fix, two of them failed on the toast (DM "Copy user ID", status popout); the text assertions passed. - `crates/fluxer-ui/tests/attachment_actions.rs`: the lightbox's "Copy link" carries the attachment's own URL. - `apps/fluxer/tests/dailyuse_runtime.rs::copy_ids_reach_text_clipboard`: `CopyId` for a user, a channel, a group DM and a guild, through the real runtime, to `desktop_rt`'s `TextClipboard` (fake). - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` is green locally. Not verified: the real system clipboard on Wayland, X11 and Windows. The last hop is iced's `clipboard::write`, unchanged here. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
On textchat every CopyId already reaches the clipboard through
menus::channel::reduce (Daily use 17); the gaps were the original's
confirmations: the DM menu's "Copy user ID" ("User ID copied"), the
status popout's "Copy user ID" and a message's Copy text / link / ID
("Copied to clipboard"). menus::dm::toast and menus::State::show_toast
add them.

Tests: fluxer-ui tests/copy_actions.rs drives every copy row from the UI
through the store to the clipboard text and its toast; the lightbox's
"Copy link" URL; dailyuse_runtime copy_ids_reach_text_clipboard runs
CopyId through the runtime to the text clipboard.

Closes #597
Refs #638

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
charles merged commit 978a6a977a into textchat 2026-11-15 12:53:32 +00:00
Sign in to join this conversation.
No description provided.