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

/explore offers a Forges chip beside All, Apps and People #6054

Merged opened this

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

Merged

scout/forge:scout/6040-explore-offers-a-forges-chip-beside-all → main 2 commits fork 1 thread · 1 unresolved

  • Merged. scout/6040-explore-offers-a-forges-chip-beside-all was merged into main as 54da313.

Review

Sign in to review this change.
2 files changed +13 −0
src/web/studio/explore.ts +1
@@ -129,6 +129,7 @@ export async function explorePage(ctx: Ctx): Promise<Response> {
129129 { label: "All", kind: "all" as const },
130130 { label: "Apps", kind: "app" as const },
131131 { label: "People", kind: "person" as const },
132 // Forges are a site admin's to see (explore.ts in actions): no chip onto an empty page.
outdated

Shown to guests and non-admins, but the data behind it (forges() in src/actions/explore.ts) is admin-only, so for them this chip always lands on an empty result. Either gate the chip as before or open the data to match, and test it.

132133 ...(ctx.auth.user?.isAdmin === true
133134 ? [{ label: "Forges", kind: "forge" as const }]
134135 : []),
test/explore.test.ts +12
@@ -338,6 +338,18 @@ describe("explore on a forge with nothing public", () => {
338338 })
339339 ).text();
340340
341 test("the Forges chip is a site admin's: current on kind:forge, sort kept, absent for a guest", async () => {
342 const chip = (q: string) => new RegExp(`<a[^>]*href="/explore\\?q=${q}"[^>]*>\\s*Forges</a\\s*>`);
343 const sorted = await get(`/explore?q=${encodeURIComponent("sort:forks")}`, true);
344 expect(sorted).toContain(`href="/explore?q=${encodeURIComponent("kind:forge sort:forks")}"`);
345 const page = await get(`/explore?q=${encodeURIComponent("kind:forge")}`, true);
346 const tag = page.match(chip("kind%3Aforge"))?.[0] ?? "";
347 expect(tag).toContain("aria-current");
348 const guest = await get(`/explore?q=${encodeURIComponent("kind:forge")}`, false);
349 expect(guest).not.toMatch(/>\s*Forges</);
350 expect(guest).toContain("Nothing");
351 });
352
341353 test("no query says nothing is public yet and how to make the first app", async () => {
342354 const out = await get("/explore", false);
343355 expect(out).toContain("Nothing public yet");

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs