feat(web): copy a link to a thread - #7902
Conversation
The web client's URL is a working thread link, but the desktop app is served from t3code://app and has no address bar, so there was no way to get a thread's address out of it at all. Thread context menus (sidebar row and chat header, which share one builder) now offer Copy > Link. In a browser the link uses the client's own origin; on desktop it falls back to the address this client reaches the environment at, so it points at the T3 server that owns the thread. When neither is an http(s) origin the item is hidden rather than copying something that cannot be opened. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Skipped Macroscope did not run approvability analysis for this PR. Macroscope could not determine whether this PR modifies its approvability configuration, so the PR was not approved automatically. A PR that may change the rules that govern approval is never approved automatically. |
Problem
In a browser, a thread's URL is its link — you can copy it out of the address bar. The desktop app is served from
t3code://appand has no address bar, and nothing in the UI exposes a thread's address, so there is no way to get a link to a thread out of desktop at all.Change
Thread context menus now offer Copy → Link. The sidebar row menu and the chat header menu share one builder, so both surfaces get it.
resolveThreadLinkpicks the base the same way a user would: the client's own web origin when there is one (browser and hosted app), otherwise the address this client reaches the environment at, which is the T3 server that owns the thread —localhostfor a server on this machine, the tunnel host for T3 Connect. When neither is an http(s) origin the item is hidden rather than copying something that cannot be opened.The link is not a share link: the other device still has to reach that address and be paired with the environment.
docs/user/thread-sidebar.mdsays so explicitly.Mobile is deliberately untouched — it has no thread copy actions at all, so there is no parity to keep.
Before / after
Sidebar thread context menu, Copy submenu.
Verification
vp test run apps/web/src/threadLink.test.ts apps/web/src/components/threadActionMenu.logic.test.ts— 14 passedtsgo --noEmitinapps/web— cleanvp run devagainst an isolated.t3home with seeded fixture threads, driven through a browserWritten by Claude Opus 5 (1M context) in T3 Code.
Note
Low Risk
Clipboard and URL construction only; no auth or access-control changes. Links still require environment pairing and network reachability.
Overview
Adds Copy → Link to the shared thread action menu (sidebar and chat header) so desktop users can copy a thread URL without an address bar.
resolveThreadLinkuses the browser origin when it is http(s); otherwise it falls back to the environment’s HTTP base (localhost or tunnel). The menu item is hidden when neither is a web origin. Links are not public shares—the recipient still needs reachability and pairing.User docs in
thread-sidebar.mddescribe the behavior. Mobile copy actions are unchanged.Reviewed by Cursor Bugbot for commit a0657a6. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add "Copy → Link" thread action in web sidebar and chat header menu
buildThreadRoutePathin threadRoutes.ts to build a thread pathname as/{environmentId}/{threadId}with URL-encoded segments.resolveThreadLinkandreadThreadLinkin threadLink.ts to compose a full HTTP(S) URL, preferringwindow.location.originand falling back to the environmenthttpBaseUrl; returnsnullwhen no valid origin exists.'copy-link'action with acanCopyLinkstate flag inbuildThreadActionMenuItems(threadActionMenu.logic.ts), wired up in both Sidebar.tsx and useThreadActionMenu.ts usinguseCopyToClipboardwith success/error toasts.'link'icon entry in contextMenuFallback.ts and documents the feature in thread-sidebar.md.httpBaseUrl,readThreadLinkreturnsnulland the menu item is hidden.Macroscope summarized a0657a6.