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

v0.7.713 was released and does not look right #17631

opened this in answer to

Merged 21h 23m ago, live in production

scout/forge:scout/17628-v0-7-713-was-released-and-does-not-look → main 0 commits fork

  • Merged. scout/17628-v0-7-713-was-released-and-does-not-look was merged into main as a0a4ac4.

Review

Sign in to review this change.
3 files changed +52 −3
src/web/studio/asks.ts +4 −2
@@ -96,13 +96,15 @@ export function appsOf(ctx: Pick<Ctx, "app">, user: User | undefined, archived =
9696 /** The apps a person can write — their own, or their organisations' — as
9797 * repositories, with their records. This is "your apps": the studio home's
9898 * shelf and its cost line, never widened by what a stranger merely made
99 * public. */
100 export function writableAppsOf(ctx: Pick<Ctx, "app">, user: User | undefined) {
99 * public. `withoutCounts` skips the star, fork and issue counts for a reader that only needs
100 * names (the home's tell box). */
101 export function writableAppsOf(ctx: Pick<Ctx, "app">, user: User | undefined, withoutCounts = false) {
101102 return appsFiltered(
102103 ctx,
103104 listReposWritableTo(ctx.app.db, user, {
104105 limit: 200,
105106 withoutArchived: true,
107 withoutCounts,
106108 }),
107109 );
108110 }
src/web/studio/living.ts +1 −1
@@ -34,7 +34,7 @@ export function pipelineNow(db: Database, at = Date.now()): Now {
3434
3535 /** The box that tells the crew: one line, the app it goes to, Tell. Posts to `/tell` as the composer does. */
3636 export function tellBox(ctx: Ctx, user: User): Html {
37 const { repos } = writableAppsOf(ctx, user);
37 const { repos } = writableAppsOf(ctx, user, true);
3838 const slug = (r: { ownerName: string; name: string }) => `${r.ownerName}/${r.name}`;
3939 const shared = sharedDraft(ctx.url.searchParams).slice(0, TELL_MAX);
4040 const { ordered, onlyForgeCopy } = appsFirst(ctx.app, repos);
test/tell-box-lean.test.ts added +47
@@ -0,0 +1,47 @@
1 /**
2 * The home's tell box reads only the names of the apps it can send to, not their issue and pull
3 * counts (#17628).
4 */
5 import { afterAll, beforeAll, expect, test } from "bun:test";
6 import { mkdtemp, rm } from "node:fs/promises";
7 import { tmpdir } from "node:os";
8 import { join } from "node:path";
9 import { createApp, type App } from "../src/app.ts";
10 import { createRepo } from "../src/actions/repos.ts";
11 import { createApp as createAppRecord } from "../src/core/apps.ts";
12 import type { User } from "../src/core/users.ts";
13 import { writableAppsOf } from "../src/web/studio/asks.ts";
14 import { seedAdmin } from "./helpers/admin.ts";
15 import { quietLogs } from "./helpers/globals.ts";
16
17 quietLogs();
18
19 let dir: string;
20 let app: App;
21 let user: User;
22
23 beforeAll(async () => {
24 dir = await mkdtemp(join(tmpdir(), "forge-tell-lean-"));
25 app = createApp({ dataDir: dir, port: 0 });
26 const a = await seedAdmin(app, { username: "alice", email: "[email protected]", password: "a-long-passphrase" });
27 if (!a.ok) throw new Error("signup failed");
28 user = a.value;
29 const made = await createRepo(app, user, { name: "engine", visibility: "private" });
30 if (!made.ok) throw new Error(String(made.error));
31 const record = createAppRecord(app.db, { repoId: made.value.id, slug: "engine", access: "private" });
32 if (!record.ok) throw new Error(record.error);
33 });
34
35 afterAll(async () => {
36 app.close?.();
37 await rm(dir, { recursive: true, force: true });
38 });
39
40 test("the lean read names the same apps and leaves the counts unread", () => {
41 const full = writableAppsOf({ app }, user);
42 const lean = writableAppsOf({ app }, user, true);
43 expect(lean.repos.map((r) => r.id)).toEqual(full.repos.map((r) => r.id));
44 expect(lean.repos.length).toBeGreaterThan(0);
45 expect(full.repos.every((r) => r.counts !== undefined)).toBe(true);
46 expect(lean.repos.every((r) => r.counts === undefined)).toBe(true);
47 });

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs