I want to explore adding a share button to threads, we had it once, what…

merged…
osebo29d ago

I want to explore adding a share button to threads, we had it once, what happened to it?

7 repliesoldestnewest
Osebotfable-5-129d ago

Digging through git history and GitHub PRs for the old share button. First lead: PR #25 "Shared threads" (merged 2026-09-28). I'll trace what it added, when it was removed and why, then report back with options for bringing it back.

Osebotfable-5-129d agothreadide@b75d006

What happened to the share button

Short version: there never was a literal "Share" button. What you remember is the per-thread "Make public" switch, which is the closest thing the thread page ever had to a share control. Its life:

WhenPRWhat
4 Oct#55 Public threadscomponents/thread-visibility.tsx: a sign-in only · make public link in the old .thread-meta line. Two-tap, wording "make public to anyone with the link?". #57 added "anyone can reply" next to it.
11 Oct#85 Thread header revisionMoved into the new Manage popover (components/thread-menu.tsx) as "Make public" / "Make sign-in only" with the eye glyph; thread-visibility.tsx deleted.
17 Oct#124 ("when I invite someone to a workspace they can only see…")You said "anyone should be able to view a forum, sign in is for posting", so every thread became readable by anyone and the switch meant nothing. Removed; threads.public column kept but unused.
21 Oct#134/#136"Let anyone reply" went the same way once guests could reply everywhere. Manage now holds only Delete.

Nothing in any of those versions ever copied a link or opened a share sheet. (PR #25 "Shared threads" is unrelated: that was the workspace invite link.) I also grepped all 133 branches and GitHub PR titles for share / copy link / navigator.share; the only link-copy code in the app is the workspace invite link on /workspaces/[id].

What I built

Since reading is open to everyone now, a share button has nothing to unlock: it just hands out the URL. So I added one, components/share-thread.tsx, at the right end of the thread status row, before Manage, shown to every reader (signed in or not):

  • Phones / Safari (where navigator.share exists): opens the native share sheet with the thread title and /threads/<id>.
  • Everywhere else: copies the canonical URL (no ?order=, no #post-… hash) and shows Copied in green for 1.5s; a clipboard failure shows "Couldn't copy" in red.
  • The three wordings are stacked in one grid cell (the MergeLabel trick) so the button never changes width.
  • Drawn like the Manage label (bare mono, --fill on hover) with a new "share" glyph (arrow out of a tray) in pulp-icons.tsx.

Screenshots attached are static mockups on the real globals.css (the app can't run in the sandbox); tsc passes. Not verified: the real iOS/Android share sheet.

If you'd rather have it elsewhere (inside Manage, as a per-post "copy link", or only for members), say so and I'll move it. Branch thread/482f5977, commit b75d006.

Thread header at 390px: Share sits before Manage at the right end of the status row (static mockup on the real globals.css)
Thread header at 390px: Share sits before Manage at the right end of the status row (static mockup on the real globals.css)
After a click without a share sheet: "Copied" in green for 1.5s, same button width
After a click without a share sheet: "Copied" in green for 1.5s, same button width
oseboasked Osebot29d ago

Share should also give me an option to make the thread public

Osebotfable-5-129d ago

Right now "public" has nothing to switch: since #124 every thread is readable by anyone, so a "Make public" item would be a no-op. To give it meaning I'm bringing back a real read gate, scoped so it doesn't change open forums:

  • Who can read a thread: anyone, when its workspace is open (an open workspace is a public forum) or the thread is public; otherwise only workspace members and the thread's creator. Everyone else gets the same 404 as an unknown id (page, GET …/posts, SSE, PRs, link previews/og image, and the thread lists / search).
  • Guest-started threads (workspace composer as a guest, the embed form) are created public, so the visitor can still open what they posted.
  • Share becomes a small menu for the creator / workspace owner: Copy link (or Share… on phones) plus Make public ↔ Make members only, with a line saying who can read the thread now. "Make public" is two-tap like the other access-widening actions. Readers who can't manage keep the one-tap share/copy. Backed by PATCH /api/threads/[id] { public }, reusing the existing threads.public column (no migration).

This partly reverses #124 for private (non-open) workspaces, which is the point of the request; nothing changes for open ones. If you'd rather have every thread members-only by default regardless of the workspace switch, that's a one-line change in the gate, say so.

Osebotfable-5-129d agothreadide@6619ef9

Gate + menu are in (commit 6619ef9 on thread/482f5977, tsc clean). Summary of what changed:

  • lib/session.ts: threadReadable() (pure rule), threadAccess() / requireThreadReader() (404 when not readable). requireThreadExists is no longer a read gate; guest replies now go through the reader check too.
  • lib/data.ts: listThreads({ reader }) SQL twin of the rule; setThreadPublic(); createThread marks guest-started threads public.
  • Read paths gated: thread page, GET …/posts, SSE events, …/prs, generateMetadata + og image (readableThreadPreview), workspace home list and GET /api/threads.
  • PATCH /api/threads/[id] { public } (creator or owner), components/share-thread.tsx menu, .badge.public green chip, CSS for the menu note/separator.

Taking a mockup screenshot of the menu now, then pushing.

Osebotfable-5-129d agothreadide@6619ef9

Share now carries the public switch

Branch thread/482f5977, commit 6619ef9 (on top of b75d006), pushed; tsc clean.

What you get on a thread you created or own: Share opens a small menu:

  • Copy link (or Share… on phones with a share sheet), with the same Copied / Couldn't copy feedback as before;
  • Make public → two-tap ("Anyone with the link?") → the thread is readable by anyone with the link; once public, the item becomes Make members only (one tap);
  • a quiet line saying who can read it now. In an open workspace it just says "Anyone can read this: … is an open workspace", since there is nothing to switch there.

A public thread inside a members-only workspace shows a green public chip next to its status badge. Plain readers still get the one-tap Share.

What had to change underneath: since #124 every thread was readable by anyone, so "public" had nothing to switch. Reading is gated again (lib/session.ts threadReadable): anyone when the workspace is open or the thread is public, else workspace members and the thread's creator; everyone else gets 404 on the page, GET …/posts, the live stream, …/prs, link previews / og cards, the workspace thread list and GET /api/threads. Guest-started threads (workspace composer as a guest, the embed form) are created public so the visitor can open what they posted. Backed by PATCH /api/threads/[id] { public } on the existing threads.public column, so no migration.

Please note before merging: in your non-open workspaces, existing threads become members-only the moment this deploys (that is what makes the switch meaningful). Open workspaces are untouched. If you'd rather every thread be members-only regardless of the workspace's Open setting, that's a one-line change in threadReadable, tell me.

Not verified: the real share sheet on a phone and the readableBy SQL against a live DB (the sandbox can't run the app); the screenshot is a static mockup on the real globals.css.

Share menu at 390px (static mockup on the real globals.css): members-only thread with Copy link + Make public, and after Make public with the green "public" chip and the way back
Share menu at 390px (static mockup on the real globals.css): members-only thread with Copy link + Make public, and after Make public with the green "public" chip and the way back
Osebot29d ago

Merged threadide #158 by @osebo (merge, 4e193be).