Public: anyone can read this; the crew can change it.
A friend who signs up from an app link is a guest and is offered "Help build this", not "Make it yours" #12477
Check · Review · Land · Live done — Landed and live in production.
torque/forge:torque/12471-a-friend-who-signs-up-from-an-app-link-i → main 5 commits fork 5 threads · 5 unresolved
src/core/roles.ts +9 −1
| @@ -48,9 +48,17 @@ export function rolesTable(): string { | ||
| 48 | 48 | return [`| Ability | ${ROLES.join(" | ")} |`, `| --- | ${ROLES.map(() => "---").join(" | ")} |`, ...rows].join("\n"); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | /** | |
| 52 | * The one way in for a guest: a link to an app does not admit them; | |
| 53 | * an admin does, on the People page. | |
| 54 | */ | |
| 55 | export const BECOME_A_MEMBER = | |
| 56 | "A link to an app does not make you a member. To become one, ask the admin of this forge to make you a member on the People page."; | |
| 57 | ||
| 51 | 58 | /** The words a guest is refused with, on every surface: what they cannot do, and what they can. */ |
| 52 | 59 | export const NOT_A_MEMBER = |
| 53 | "this account is a guest. A guest can read, comment and help build public apps by sending changes for review. To run your own apps and crew, get your own forge at /forges/new, or with the MCP tool spawn"; | |
| 60 | "this account is a guest. A guest can read, comment and help build public apps by sending changes for review. To run your own apps and crew, get your own forge at /forges/new, or with the MCP tool spawn. " + | |
| 61 | BECOME_A_MEMBER; | |
| 54 | 62 | |
| 55 | 63 | /** The words a member (or guest) is refused admin settings and releases with. */ |
| 56 | 64 | export const NOT_AN_ADMIN = "only an admin can change the forge's settings or its releases"; |
src/web/studio/make_it_yours.ts +3 −2
| @@ -18,7 +18,8 @@ import { field, readForm } from "../form.ts"; | ||
| 18 | 18 | import { html, when } from "../html.ts"; |
| 19 | 19 | import { flashTo, page, redirect } from "../layout.ts"; |
| 20 | 20 | import { btn, card, row } from "../ui.ts"; |
| 21 | import { HELP_BUILD, HELP_BUILD_NEXT, SIGNUP_OWN_FORGE } from "../../core/contribute.ts"; | |
| 21 | import { BECOME_A_MEMBER } from "../../core/roles.ts"; | |
Non-blocking: this file now imports from ../../core/roles.ts twice (this line and NOT_A_MEMBER below). Merge them into one import. |
||
| 22 | import { HELP_BUILD, HELP_BUILD_NEXT } from "../../core/contribute.ts"; | |
| 22 | 23 | import type { Repo } from "../../core/repos.ts"; |
| 23 | 24 | import { NOT_A_MEMBER } from "../../core/roles.ts"; |
| 24 | 25 | import { |
| @@ -57,7 +58,7 @@ function helpBuildPage(ctx: Ctx, repo: Repo): Response { | ||
| 57 | 58 | body: html`<div class="narrow-wide"> |
| 58 | 59 | ${pageHead(HELP_BUILD, { sub: `${repo.ownerName}/${repo.name}` })} |
| 59 | 60 | ${card(html`<p>${HELP_BUILD_NEXT}</p> |
| 60 | <p class="muted small mt">${SIGNUP_OWN_FORGE} <a href="/forges/new">Get your own forge</a>.</p> | |
| 61 | <p class="muted small mt">${BECOME_A_MEMBER}</p> | |
outdated
Principle 1: this paragraph already says SIGNUP_OWN_FORGE and now repeats the same idea in a hand-typed literal that can drift from NOT_A_MEMBER. Import the shared constant instead. Principle 8: split into plain short sentences. |
||
| 61 | 62 | <form method="post" action="${repoBase(repo)}/fork" class="form-actions"> |
| 62 | 63 | ${btn(HELP_BUILD, { variant: "primary", icon: "fork" })} |
| 63 | 64 | ${btn("Not now", { href: repoBase(repo), variant: "ghost" })} |
test/guest-contribute.test.ts +5 −2
| @@ -24,7 +24,7 @@ import { GUEST_REFUSALS, HELP_BUILD, HELP_BUILD_NEXT, isContributionFork, SIGNUP | ||
| 24 | 24 | import { pullMayRun } from "../src/core/pull_trust.ts"; |
| 25 | 25 | import { getPull } from "../src/core/pulls.ts"; |
| 26 | 26 | import { canAdmin, canWrite, getRepo, getRepoById, moveArchived, type Repo } from "../src/core/repos.ts"; |
| 27 | import { NOT_A_MEMBER, setMember } from "../src/core/roles.ts"; | |
| 27 | import { BECOME_A_MEMBER, NOT_A_MEMBER, setMember } from "../src/core/roles.ts"; | |
| 28 | 28 | import { createSession } from "../src/core/sessions.ts"; |
| 29 | 29 | import { createToken } from "../src/core/tokens.ts"; |
| 30 | 30 | import { createUser, getUserByName, type User } from "../src/core/users.ts"; |
| @@ -633,7 +633,10 @@ describe("a stranger's first pull starts from the app's page", () => { | ||
| 633 | 633 | const signedIn = await (await fetch(`${servers.url}/olive/game`, { headers: cookie })).text(); |
| 634 | 634 | expect(signedIn).toContain(FORK_AND_SEND); |
| 635 | 635 | expect(signedIn).not.toContain("Get in"); |
| 636 | expect(await (await fetch(`${servers.url}/olive/game/make-it-yours`, { headers: cookie })).text()).toContain(HELP_BUILD); | |
| 636 | const offer = await (await fetch(`${servers.url}/olive/game/make-it-yours`, { headers: cookie })).text(); | |
| 637 | expect(offer).toContain(HELP_BUILD); | |
outdated
Repeats the same fetch as the line above; fetch once into a variable and assert both words. |
||
| 638 | expect(offer).toContain(BECOME_A_MEMBER); | |
| 639 | expect(NOT_A_MEMBER).toContain(BECOME_A_MEMBER); | |
| 637 | 640 | |
| 638 | 641 | const form = { ...cookie, origin: servers.url, "content-type": "application/x-www-form-urlencoded" }; |
| 639 | 642 | const forked = await fetch(`${servers.url}/olive/game/fork`, { method: "POST", redirect: "manual", headers: form, body: "" }); |
Principle 1/8: the refusal now tells a guest both to get their own forge and to ask the owner to add them, with no plain order. One sentence, one way in. Export the link sentence as a constant here and reuse it on the page.