Public: anyone can read this; the crew can change it.
On a preview, the /__forge/ door links "What changed" to the pull's files, for a reader of the repository #7892
Check · Review · Land · Live done — Landed and live in production.
torque/forge:torque/7885-on-a-preview-the-forge-door-links-what-c → main 2 commits fork
2 files
changed +13
−0
src/apps/door.ts +2
| @@ -124,6 +124,8 @@ export function doorPage(facts: DoorFacts, head: boolean): Response { | ||
| 124 | 124 | if (where.repo !== undefined) { |
| 125 | 125 | const repoUrl = new URL(`/${where.repo}`, forgeUrl).href; |
| 126 | 126 | links.push(link(repoUrl, `The repository, ${where.repo}`)); |
| 127 | if (where.pull !== undefined) | |
| 128 | links.push(link(new URL(`/${where.repo}/pulls/${where.pull}/files`, forgeUrl).href, "What changed")); | |
| 127 | 129 | links.push(link(`${repoUrl}/make-it-yours`, "Make it yours")); |
| 128 | 130 | morePulls = `${repoUrl}/pulls`; |
| 129 | 131 | } |
test/apps-door.test.ts +11
| @@ -432,6 +432,17 @@ test("the door links a dormant preview to itself, and says so when more than fiv | ||
| 432 | 432 | expect((html.match(/ · check /g) ?? []).length).toBe(5); |
| 433 | 433 | }); |
| 434 | 434 | |
| 435 | test("a preview links What changed for a reader only, never on production or for a guest", async () => { | |
| 436 | const forgeUrl = "http://forge.test"; | |
| 437 | const text = (where: PillWhere) => doorPage({ where, forgeUrl }, false).text(); | |
| 438 | const reader = await text({ app: "notes", env: "pull-7", pull: 7, repo: "alice/notes" }); | |
| 439 | expect(reader).toContain('<li><a href="http://forge.test/alice/notes/pulls/7/files">What changed</a></li>'); | |
| 440 | expect(reader.indexOf("The repository")).toBeLessThan(reader.indexOf("What changed")); | |
| 441 | expect(reader.indexOf("What changed")).toBeLessThan(reader.indexOf("Make it yours")); | |
| 442 | expect(await text({ app: "notes", env: "pull-7", pull: 7 })).not.toContain("What changed"); | |
| 443 | expect(await text({ app: "notes", env: "production", repo: "alice/notes" })).not.toContain("What changed"); | |
| 444 | }); | |
| 445 | ||
| 435 | 446 | test("the door names the crew run working here, linked, to who may see it", async () => { |
| 436 | 447 | const bob = await createUser(app.db, { |
| 437 | 448 | origin: "seed", |
new above
offline