Public: anyone can read this; the crew can change it.
Full suite red: test/archived-hidden-everywhere.test.ts #15431
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/15429-full-suite-red-test-archived-hidden-ever → main 0 commits fork
2 files
changed +18
−2
src/web/studio/since.ts +5 −2
| @@ -29,13 +29,16 @@ interface Red { | ||
| 29 | 29 | finished_at: string; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | /** Repositories are read through `canRead`, the feed's own check, once each. */ | |
| 32 | /** | |
| 33 | * Repositories are read through `canRead`, the feed's own check, once each; an archived one is put | |
| 34 | * away (#1838). | |
| 35 | */ | |
| 33 | 36 | function readable(db: Database, viewer: User | undefined): (repoId: string) => Repo | undefined { |
| 34 | 37 | const seen = new Map<string, Repo | undefined>(); |
| 35 | 38 | return (id) => { |
| 36 | 39 | if (!seen.has(id)) { |
| 37 | 40 | const repo = getRepoById(db, id); |
| 38 | seen.set(id, repo && canRead(db, repo, viewer) ? repo : undefined); | |
| 41 | seen.set(id, repo && repo.archivedAt == null && canRead(db, repo, viewer) ? repo : undefined); | |
| 39 | 42 | } |
| 40 | 43 | return seen.get(id); |
| 41 | 44 | }; |
test/home-since-sources.test.ts +13
| @@ -69,3 +69,16 @@ test("release and failed lines link to readable pages, the pull when known", () | ||
| 69 | 69 | expect(hrefs).toContain(`/${repo.ownerName}/${repo.name}/pulls/1`); |
| 70 | 70 | expect(hrefs.some((h) => h.startsWith("/api/") || h === "/releases")).toBe(false); |
| 71 | 71 | }); |
| 72 | ||
| 73 | test("an archived repository's landed pull makes no digest line (#15429)", () => { | |
| 74 | const repo = f.repos.find((r) => r.visibility === "public")!; | |
| 75 | land(repo.id, H / 3); | |
| 76 | const name = `${repo.ownerName}/${repo.name}`; | |
| 77 | expect(eventsSince(db(), f.peer, Date.now() - 3 * H, Date.now()).some((e) => e.repo === name)).toBe(true); | |
| 78 | db().query("UPDATE repo SET archived_at = ?1 WHERE id = ?2").run(iso(0), repo.id); | |
| 79 | try { | |
| 80 | expect(eventsSince(db(), f.peer, Date.now() - 3 * H, Date.now()).some((e) => e.repo === name)).toBe(false); | |
| 81 | } finally { | |
| 82 | db().query("UPDATE repo SET archived_at = NULL WHERE id = ?1").run(repo.id); | |
| 83 | } | |
| 84 | }); |
new above
offline