feat: followers-only recipe visibility

Adds a fourth visibility tier alongside private/unlisted/public:
"followers" — visible to the author and anyone who follows them,
excluded from public search/explore/profile listings and from the
anonymous /r/[id] share route, included in the Following feed. The
in-app recipe detail gate and the public share route both check
follow status directly against the DB rather than the union type
alone, since neither previously had any per-viewer access logic for
a non-public/non-owner case.

Requires the generated migration (0041) to run against a live DB —
not applied in this sandbox (no Docker here); run `pnpm db:migrate`.

v0.41.0
This commit is contained in:
Arnaud
2026-07-17 17:05:10 +02:00
parent 23babd4ee9
commit 77c739960d
29 changed files with 5183 additions and 43 deletions
+4 -3
View File
@@ -28,9 +28,10 @@ export default async function RecipePrintPage({ params }: Params) {
if (!recipe) notFound();
// /r/[id] resolves for both "public" and "unlisted" (see app/r/[id]/page.tsx)
// — only "private" has no scannable link to offer.
const shareUrl = recipe.visibility !== "private"
// /r/[id] resolves anonymously for "public" and "unlisted" only (see
// app/r/[id]/page.tsx) — "private" and "followers" have no link a random
// scanner of this QR code could actually open.
const shareUrl = recipe.visibility === "public" || recipe.visibility === "unlisted"
? `${process.env["BETTER_AUTH_URL"] ?? "http://localhost:3000"}/r/${id}`
: null;
const qrDataUrl = shareUrl ? await QRCode.toDataURL(shareUrl, { margin: 1, width: 120 }) : null;