Public: anyone can read this; the crew can change it.

A guest told "a link to an app does not make you a member" is offered the button that asks an admin; main's sentence rule is green again #12974

Merged opened this

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

Merged

trevato/roles-refusal-leads-somewhere → main 1 commit 1 thread · 1 unresolved

  • Merged. trevato/roles-refusal-leads-somewhere was merged into main as ebbb84e.

Review

Sign in to review this change.
3 files changed +17 −6
src/core/roles.ts +9 −4
@@ -8,6 +8,7 @@
88 * Pure data; who may promote is the action's.
99 */
1010
11 import { storedText } from "../kernel/blocked.ts";
1112 import type { Database } from "bun:sqlite";
1213 import { isUnclaimed } from "./starts.ts";
1314
@@ -48,12 +49,16 @@ export function rolesTable(): string {
4849 return [`| Ability | ${ROLES.join(" | ")} |`, `| --- | ${ROLES.map(() => "---").join(" | ")} |`, ...rows].join("\n");
4950 }
5051
52 /** What a guest who came by an app's link is told first. */
53 export const LINK_IS_NOT_MEMBERSHIP = "A link to an app does not make you a member.";
54
5155 /**
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.
56 * The one way in for a guest: a link to an app does not admit them; an admin
57 * does. Said to any reader with who can, in words (`kernel/blocked.ts`); a
58 * page that knows its reader offers the button that asks an admin beside it
59 * (`actions/blocked_words.ts` `notMemberBlocked`).
5460 */
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.";
61 export const BECOME_A_MEMBER = storedText(LINK_IS_NOT_MEMBERSHIP, "an admin of this forge", "make you one");
5762
5863 /** The words a guest is refused with, on every surface: what they cannot do, and what they can. */
5964 export const NOT_A_MEMBER =
src/web/studio/make_it_yours.ts +4 −2
@@ -5,6 +5,8 @@
55 * `actions/make_it_yours.ts`.
66 */
77
8 import { blockedWay } from "../blocked.ts";
9 import { notMemberBlocked } from "../../actions/blocked_words.ts";
810 import { COPIES_PER_DAY, makeItYours, receiptWords, undoMakeItYours } from "../../actions/make_it_yours.ts";
911 import type { Ctx } from "../../http/context.ts";
1012 import {
@@ -18,7 +20,7 @@ import { field, readForm } from "../form.ts";
1820 import { html, when } from "../html.ts";
1921 import { flashTo, page, redirect } from "../layout.ts";
2022 import { btn, card, row } from "../ui.ts";
21 import { BECOME_A_MEMBER } from "../../core/roles.ts";
23 import { BECOME_A_MEMBER, LINK_IS_NOT_MEMBERSHIP } from "../../core/roles.ts";
2224 import { HELP_BUILD, HELP_BUILD_NEXT } from "../../core/contribute.ts";
2325 import type { Repo } from "../../core/repos.ts";
2426 import { NOT_A_MEMBER } from "../../core/roles.ts";
@@ -58,7 +60,7 @@ function helpBuildPage(ctx: Ctx, repo: Repo): Response {
5860 body: html`<div class="narrow-wide">
5961 ${pageHead(HELP_BUILD, { sub: `${repo.ownerName}/${repo.name}` })}
6062 ${card(html`<p>${HELP_BUILD_NEXT}</p>
61 <p class="muted small mt">${BECOME_A_MEMBER}</p>
63 <p class="muted small mt">${ctx.auth.user === undefined ? BECOME_A_MEMBER : html`${LINK_IS_NOT_MEMBERSHIP} ${blockedWay(notMemberBlocked(ctx.app, ctx.auth.user, LINK_IS_NOT_MEMBERSHIP))}`}</p>

Minor: this ternary is hard to read inline. Pull it into a named helper. The behaviour is right.

6264 <form method="post" action="${repoBase(repo)}/fork" class="form-actions">
6365 ${btn(HELP_BUILD, { variant: "primary", icon: "fork" })}
6466 ${btn("Not now", { href: repoBase(repo), variant: "ghost" })}
test/guest-contribute.test.ts +4
@@ -636,6 +636,10 @@ describe("a stranger's first pull starts from the app's page", () => {
636636 const offer = await (await fetch(`${servers.url}/olive/game/make-it-yours`, { headers: cookie })).text();
637637 expect(offer).toContain(HELP_BUILD);
638638 expect(offer).toContain(BECOME_A_MEMBER);
639 // With the one button that asks an admin, and the form it submits (`web/blocked.ts`).
640 expect(offer).toContain('value="membership ');
641 expect(offer).toContain('action="/asks/admin" id="ask-who-can"');
642 expect(BECOME_A_MEMBER).toBe("A link to an app does not make you a member. An admin of this forge can make you one.");
639643 expect(NOT_A_MEMBER).toContain(BECOME_A_MEMBER);
640644
641645 const form = { ...cookie, origin: servers.url, "content-type": "application/x-www-form-urlencoded" };

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs