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

Activity wording for build.shots events #9280

Merged opened this

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

Merged

mason/forge:mason/9220-activity-wording-for-build-shots-events → main 1 commit fork

  • Merged. mason/9220-activity-wording-for-build-shots-events was merged into main as c465bea.

Review

Sign in to review this change.
2 files changed +32 −0
src/design/activity.ts +14
@@ -73,6 +73,17 @@ export function eventVerb(event: ForgeEvent): string {
7373 if (kind === "app.domain.verified") return `verified the domain ${which}`;
7474 return `removed the domain ${which}`;
7575 }
76 if (kind === "build.shots") {
77 const label = payload["label"];
78 const pin = typeof label === "string" && label !== "" ? `the pin ${label}` : "a pin";
79 const change = payload["change"];
80 if (change === "added") return `added a screenshot to ${pin}`;
81 if (change === "picked") return `picked screenshots from the deploy for ${pin}`;
82 if (change === "moved") return `reordered the screenshots of ${pin}`;
83 if (change === "captioned") return `captioned a screenshot of ${pin}`;
84 if (change === "removed") return `removed a screenshot from ${pin}`;
85 return `changed the screenshots of ${pin}`;
86 }
7687 if (kind === "prompt.told") {
7788 const issue = payload["issue"];
7889 return typeof issue === "number"
@@ -167,6 +178,9 @@ const WORDS: Record<string, string> = {
167178 "origin.disconnected": "disconnected an origin",
168179 "origin.needs_reauth": "needs to reconnect an origin",
169180 "origin.mirror_reattached": "reconnected a frozen mirror to its origin",
181 "build.pinned": "pinned a build",
182 "build.deleted": "removed a build pin",
183 "build.noted": "noted a pinned build",
170184 "run.queued": "queued a run",
171185 "run.started": "started a run",
172186 "app.created": "made it an app",
test/build-shots.test.ts +18
@@ -24,6 +24,7 @@ import { createUser, getUserByName, type User } from "../src/core/users.ts";
2424 import { repoDir } from "../src/git/repos.ts";
2525 import { readShots, SHOT_MAX } from "../src/git/shots.ts";
2626 import { serve, type Servers } from "../src/http/server.ts";
27 import { eventVerb } from "../src/design/activity.ts";
2728 import { gitClientEnv } from "./helpers/git-client.ts";
2829
2930 const PNG = (n: number) => new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, n, n]);
@@ -296,3 +297,20 @@ describe("pin screenshots", () => {
296297 expect((await shots()).items).toEqual([]);
297298 });
298299 });
300
301 describe("activity wording for build events", () => {
302 const say = (kind: string, payload: Record<string, unknown>) =>
303 eventVerb({ id: "e", kind, repoId: null, actorId: null, payload, createdAt: "" });
304
305 test("every shots change and every build kind has a line", () => {
306 expect(say("build.shots", { label: "v1", change: "added" })).toBe("added a screenshot to the pin v1");
307 expect(say("build.shots", { label: "v1", change: "picked" })).toBe("picked screenshots from the deploy for the pin v1");
308 expect(say("build.shots", { label: "v1", change: "moved" })).toBe("reordered the screenshots of the pin v1");
309 expect(say("build.shots", { label: "v1", change: "captioned" })).toBe("captioned a screenshot of the pin v1");
310 expect(say("build.shots", { label: "v1", change: "removed" })).toBe("removed a screenshot from the pin v1");
311 expect(say("build.shots", {})).toBe("changed the screenshots of a pin");
312 expect(say("build.pinned", {})).toBe("pinned a build");
313 expect(say("build.deleted", {})).toBe("removed a build pin");
314 expect(say("build.noted", {})).toBe("noted a pinned build");
315 });
316 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs