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

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

torque/forge:torque/12471-a-friend-who-signs-up-from-an-app-link-i → main 5 commits fork 5 threads · 5 unresolved

  • Merged. torque/12471-a-friend-who-signs-up-from-an-app-link-i was merged into main as 029ac15.

Review

Sign in to review this change.
3 files changed +17 −5
src/core/roles.ts +9 −1
@@ -48,9 +48,17 @@ export function rolesTable(): string {
4848 return [`| Ability | ${ROLES.join(" | ")} |`, `| --- | ${ROLES.map(() => "---").join(" | ")} |`, ...rows].join("\n");
4949 }
5050
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.
outdated

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.

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
5158 /** The words a guest is refused with, on every surface: what they cannot do, and what they can. */
5259 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;
5462
5563 /** The words a member (or guest) is refused admin settings and releases with. */
5664 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";
1818 import { html, when } from "../html.ts";
1919 import { flashTo, page, redirect } from "../layout.ts";
2020 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";
2223 import type { Repo } from "../../core/repos.ts";
2324 import { NOT_A_MEMBER } from "../../core/roles.ts";
2425 import {
@@ -57,7 +58,7 @@ function helpBuildPage(ctx: Ctx, repo: Repo): Response {
5758 body: html`<div class="narrow-wide">
5859 ${pageHead(HELP_BUILD, { sub: `${repo.ownerName}/${repo.name}` })}
5960 ${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.

6162 <form method="post" action="${repoBase(repo)}/fork" class="form-actions">
6263 ${btn(HELP_BUILD, { variant: "primary", icon: "fork" })}
6364 ${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
2424 import { pullMayRun } from "../src/core/pull_trust.ts";
2525 import { getPull } from "../src/core/pulls.ts";
2626 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";
2828 import { createSession } from "../src/core/sessions.ts";
2929 import { createToken } from "../src/core/tokens.ts";
3030 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", () => {
633633 const signedIn = await (await fetch(`${servers.url}/olive/game`, { headers: cookie })).text();
634634 expect(signedIn).toContain(FORK_AND_SEND);
635635 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);
637640
638641 const form = { ...cookie, origin: servers.url, "content-type": "application/x-www-form-urlencoded" };
639642 const forked = await fetch(`${servers.url}/olive/game/fork`, { method: "POST", redirect: "manual", headers: form, body: "" });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs