From 8f92848e2b9ac66c6020e9b36777c16aa5ee938c Mon Sep 17 00:00:00 2001 From: adilallo <39313955+adilallo@users.noreply.github.com> Date: Fri, 20 Nov 2026 13:20:40 -0700 Subject: [PATCH 1/5] Give /kit its own page so the printed facilitator-guide link still works after cutover. --- .../_components/LegalDocumentPage.tsx | 2 +- app/(marketing)/kit/page.tsx | 29 ++++++- lib/legalSyntheticPost.ts | 3 +- lib/publicSitemap.ts | 1 + messages/en/index.ts | 2 + messages/en/marketing.ts | 2 + messages/en/metadata.json | 5 ++ messages/en/pages/kit.json | 55 +++++++++++++ tests/pages/kit.test.tsx | 82 +++++++++++++++++++ tests/unit/legalSyntheticPost.test.ts | 1 + tests/unit/publicSitemap.test.ts | 2 +- 11 files changed, 177 insertions(+), 7 deletions(-) create mode 100644 messages/en/pages/kit.json create mode 100644 tests/pages/kit.test.tsx diff --git a/app/(marketing)/_components/LegalDocumentPage.tsx b/app/(marketing)/_components/LegalDocumentPage.tsx index a5c9081..ff42028 100644 --- a/app/(marketing)/_components/LegalDocumentPage.tsx +++ b/app/(marketing)/_components/LegalDocumentPage.tsx @@ -91,7 +91,7 @@ export function legalPageMetadata( } /** - * Public legal documents (`/privacy`, `/terms`, `/cookies`). + * Public Content page Template documents (`/privacy`, `/terms`, `/cookies`, `/kit`). * * Figma: "Content page Template" (19003:23305) — ContentBanner guide * (22078:806964) + article column (19003:23574). Body stacks follow diff --git a/app/(marketing)/kit/page.tsx b/app/(marketing)/kit/page.tsx index e943c22..7de4922 100644 --- a/app/(marketing)/kit/page.tsx +++ b/app/(marketing)/kit/page.tsx @@ -1,6 +1,27 @@ -import { redirect } from "next/navigation"; +/** + * Figma: "C8 Kit page / 1440+" (25218:120616) on "Content page Template" (19003:23305) + * https://www.figma.com/design/agv0VBLiBlcnSAaiAORgPR/Community-Rule-System?node-id=25218-120616 + */ +import type { Metadata } from "next"; +import messages from "../../../messages/en/index"; +import { legalPathForSlug } from "../../../lib/legalSyntheticPost"; +import { routeMetadata } from "../../../lib/siteMetadata"; +import LegalDocumentPage, { + legalPageMetadata, +} from "../_components/LegalDocumentPage"; -/** Office-hours pointer used in the 48-hour follow-up email. */ -export default function KitPage() { - redirect("/workshops"); +const SLUG = "kit" as const; +const PATH = legalPathForSlug(SLUG); + +export function generateMetadata(): Metadata { + return routeMetadata( + PATH, + legalPageMetadata(messages.metadata.kit, messages.pages.kit), + ); +} + +export default function KitPage() { + return ( + + ); } diff --git a/lib/legalSyntheticPost.ts b/lib/legalSyntheticPost.ts index 878ada4..b5a8b3e 100644 --- a/lib/legalSyntheticPost.ts +++ b/lib/legalSyntheticPost.ts @@ -1,6 +1,6 @@ import type { BlogPost } from "./content"; -export type LegalDocumentSlug = "privacy" | "terms" | "cookies"; +export type LegalDocumentSlug = "privacy" | "terms" | "cookies" | "kit"; export type LegalDocumentSection = { heading: string; @@ -23,6 +23,7 @@ const PATH_BY_SLUG: Record = { privacy: "/privacy", terms: "/terms", cookies: "/cookies", + kit: "/kit", }; export function legalPathForSlug(slug: LegalDocumentSlug): string { diff --git a/lib/publicSitemap.ts b/lib/publicSitemap.ts index a88ac6a..ef8bd38 100644 --- a/lib/publicSitemap.ts +++ b/lib/publicSitemap.ts @@ -11,6 +11,7 @@ const STATIC_PUBLIC_PATHS = [ "/templates", "/blog", "/how-it-works", + "/kit", "/privacy", "/terms", "/cookies", diff --git a/messages/en/index.ts b/messages/en/index.ts index 0816f66..765ddcd 100644 --- a/messages/en/index.ts +++ b/messages/en/index.ts @@ -27,6 +27,7 @@ import useCasesDetail from "./pages/useCasesDetail.json"; import useCasesCompletedRules from "./pages/useCasesCompletedRules.json"; import useCasesCompletedRule from "./pages/useCasesCompletedRule.json"; import howItWorks from "./pages/howItWorks.json"; +import kit from "./pages/kit.json"; import privacy from "./pages/privacy.json"; import terms from "./pages/terms.json"; import cookies from "./pages/cookies.json"; @@ -112,6 +113,7 @@ export default { useCasesCompletedRules, useCasesCompletedRule, howItWorks, + kit, privacy, terms, cookies, diff --git a/messages/en/marketing.ts b/messages/en/marketing.ts index 4922025..29f9dbc 100644 --- a/messages/en/marketing.ts +++ b/messages/en/marketing.ts @@ -39,6 +39,7 @@ import useCasesDetail from "./pages/useCasesDetail.json"; import useCasesCompletedRules from "./pages/useCasesCompletedRules.json"; import useCasesCompletedRule from "./pages/useCasesCompletedRule.json"; import howItWorks from "./pages/howItWorks.json"; +import kit from "./pages/kit.json"; import privacy from "./pages/privacy.json"; import terms from "./pages/terms.json"; import cookies from "./pages/cookies.json"; @@ -84,6 +85,7 @@ const marketingMessages = { useCasesCompletedRules, useCasesCompletedRule, howItWorks, + kit, privacy, terms, cookies, diff --git a/messages/en/metadata.json b/messages/en/metadata.json index 2b836b3..773a6ea 100644 --- a/messages/en/metadata.json +++ b/messages/en/metadata.json @@ -147,6 +147,11 @@ ] } }, + "kit": { + "title": "The kit", + "description": "Everything your community needs to write its Rule together over five short meetings you already hold. Free for volunteer-run groups.", + "keywords": ["kit", "facilitator guide", "office hours", "communityrule"] + }, "howItWorks": { "title": "When your community sits down to write its Rule", "description": "Sketch your Rule in CommunityRule, then make it your community's own over five short meetings.", diff --git a/messages/en/pages/kit.json b/messages/en/pages/kit.json new file mode 100644 index 0000000..191d92f --- /dev/null +++ b/messages/en/pages/kit.json @@ -0,0 +1,55 @@ +{ + "_comment": "Kit page at /kit. Figma C8 Kit page (25218:120616) on the Content page Template. Facilitator guide and FigJam board are live; printed cards, poster and zine are named without download links until those files exist. Office hours start 22 February 2027; the page names no weekday until two people can commit to one.", + "banner": { + "title": "The kit", + "description": "Everything your community needs to write its Rule together over five short meetings you already hold. Free for volunteer-run groups.", + "author": "Media Economies Design Lab", + "date": "2027-01-19" + }, + "updated": "Last updated January 19, 2027.", + "intro": [ + "The kit is how a community writes its Rule without us in the room. Any member can run it. It spreads the work over five short meetings your community already holds, and it starts on paper." + ], + "sections": [ + { + "heading": "What is in it", + "paragraphs": [ + "The facilitator guide, with a printable worksheet for each meeting. [Download the facilitator guide](https://colorado-mutual-aid.notion.site/Workshop-facilitator-guide-40fb9b9e2d3b81b683c0ca15de007f2a).", + "The FigJam board, for communities that meet online. [Open the board](https://www.figma.com/board/gnQ55HnX7EtOV9nwlZcW1V?node-id=32-80).", + "Thirteen template cards, one for each template.", + "The four questions poster.", + "The zine.", + "No form and no account. [Download the kit](https://colorado-mutual-aid.notion.site/Workshop-facilitator-guide-40fb9b9e2d3b81b683c0ca15de007f2a)." + ] + }, + { + "heading": "How the five meetings run", + "paragraphs": [ + "The first meeting runs an hour. It opens with the question nobody has asked out loud, then takes the first of the four questions. How you talk, who belongs, how you decide and what happens when you disagree.", + "The next three meetings take one question each, in forty-five minutes.", + "The last meeting takes your values and the signs that one is slipping. Then someone reads the draft aloud and it goes to every member.", + "A community with more time can take two questions in one meeting of ninety minutes.", + "Every meeting opens by reading aloud how the room decides, and closes the same way. Only the close puts anything into CommunityRule.", + "The draft becomes your Rule once every member has read it and has had at least seven days to object. Objections close the day before your next regular meeting, and that meeting settles them the way the draft says. [Create rule](/create/informational)." + ] + }, + { + "heading": "Office hours", + "paragraphs": [ + "Bring your draft, your Rule or a question. No signup. Office hours start 22 February 2027. They run every week through 20 March 2027, then every month. Times are listed here once they are set." + ] + }, + { + "heading": "Stuck between meetings", + "paragraphs": [ + "[Ask an organizer](/#ask-organizer). A person writes back within two working days." + ] + }, + { + "heading": "A larger organization", + "paragraphs": [ + "Credit unions, mutuals and co-ops with thousands of members can bring a facilitator. [Talk to a facilitator](/workshops#workshop-signup)." + ] + } + ] +} diff --git a/tests/pages/kit.test.tsx b/tests/pages/kit.test.tsx new file mode 100644 index 0000000..8e61380 --- /dev/null +++ b/tests/pages/kit.test.tsx @@ -0,0 +1,82 @@ +import { describe, expect, test, vi } from "vitest"; +import { screen } from "@testing-library/react"; +import { renderWithProviders as render } from "../utils/test-utils"; +import LegalDocumentPage from "../../app/(marketing)/_components/LegalDocumentPage"; +import { legalPathForSlug } from "../../lib/legalSyntheticPost"; +import messages from "../../messages/en/index"; + +vi.mock("../../lib/requestSiteOrigin", () => ({ + getRequestSiteOrigin: async () => "https://communityrule.info", +})); + +vi.mock("../../app/components/sections/ContentBanner", () => ({ + default: ({ post, variant, updatedLabel }) => ( +
+

{post.frontmatter.title}

+

{post.frontmatter.description}

+ {updatedLabel ? ( +
+ {post.frontmatter.author} + {updatedLabel} +
+ ) : null} +
+ ), +})); + +async function renderKitPage() { + const page = messages.pages.kit; + const ui = await LegalDocumentPage({ + slug: "kit", + path: legalPathForSlug("kit"), + page, + }); + return render(ui); +} + +describe("kit page", () => { + test("covers the five meetings, the facilitator guide, and office hours", async () => { + await renderKitPage(); + const page = messages.pages.kit; + + expect(screen.getByTestId("content-banner")).toHaveAttribute( + "data-variant", + "guide", + ); + expect( + screen.getByRole("heading", { level: 1, name: page.banner.title }), + ).toBeInTheDocument(); + expect(screen.getByText(page.banner.description)).toBeInTheDocument(); + expect( + screen.getByRole("heading", { level: 2, name: "What is in it" }), + ).toBeInTheDocument(); + expect( + screen.getByRole("heading", { level: 2, name: "How the five meetings run" }), + ).toBeInTheDocument(); + expect( + screen.getByRole("heading", { level: 2, name: "Office hours" }), + ).toBeInTheDocument(); + expect( + screen.getByRole("link", { name: "Download the facilitator guide" }), + ).toHaveAttribute( + "href", + "https://colorado-mutual-aid.notion.site/Workshop-facilitator-guide-40fb9b9e2d3b81b683c0ca15de007f2a", + ); + expect(screen.getByRole("link", { name: "Open the board" })).toHaveAttribute( + "href", + "https://www.figma.com/board/gnQ55HnX7EtOV9nwlZcW1V?node-id=32-80", + ); + expect(screen.getByRole("link", { name: "Create rule" })).toHaveAttribute( + "href", + "/create/informational", + ); + expect(screen.getByRole("link", { name: "Ask an organizer" })).toHaveAttribute( + "href", + "/#ask-organizer", + ); + expect( + screen.getByRole("link", { name: "Talk to a facilitator" }), + ).toHaveAttribute("href", "/workshops#workshop-signup"); + expect(screen.getByText(/22 February 2027/)).toBeInTheDocument(); + }); +}); diff --git a/tests/unit/legalSyntheticPost.test.ts b/tests/unit/legalSyntheticPost.test.ts index f7f7391..87a0036 100644 --- a/tests/unit/legalSyntheticPost.test.ts +++ b/tests/unit/legalSyntheticPost.test.ts @@ -9,6 +9,7 @@ describe("legalSyntheticPost", () => { expect(legalPathForSlug("privacy")).toBe("/privacy"); expect(legalPathForSlug("terms")).toBe("/terms"); expect(legalPathForSlug("cookies")).toBe("/cookies"); + expect(legalPathForSlug("kit")).toBe("/kit"); }); it("builds a guide-shaped post from page messages", () => { diff --git a/tests/unit/publicSitemap.test.ts b/tests/unit/publicSitemap.test.ts index de23c5d..21b254b 100644 --- a/tests/unit/publicSitemap.test.ts +++ b/tests/unit/publicSitemap.test.ts @@ -16,6 +16,7 @@ describe("buildPublicSitemap", () => { expect(urls).toContain(sitemapUrl("/blog")); expect(urls).not.toContain(sitemapUrl("/use-cases")); expect(urls).toContain(sitemapUrl("/how-it-works")); + expect(urls).toContain(sitemapUrl("/kit")); expect(urls).toContain(sitemapUrl("/privacy")); expect(urls).toContain(sitemapUrl("/terms")); expect(urls).toContain(sitemapUrl("/cookies")); @@ -36,7 +37,6 @@ describe("buildPublicSitemap", () => { expect(urls.some((url) => url.includes("/create"))).toBe(false); expect(urls.some((url) => url.includes("/monitor"))).toBe(false); expect(urls.some((url) => url.includes("/rule-counts"))).toBe(false); - expect(urls.some((url) => url.includes("/kit"))).toBe(false); expect(urls.some((url) => url.includes("/api/"))).toBe(false); }); -- 2.53.0 From ead6c8f7169b2d4b037d2ecaab7d13215f8fa992 Mon Sep 17 00:00:00 2001 From: adilallo <39313955+adilallo@users.noreply.github.com> Date: Fri, 20 Nov 2026 13:21:44 -0700 Subject: [PATCH 2/5] Hold the press kit at /press in its embargoed form until the February launch. --- .../_components/LegalDocumentPage.tsx | 2 +- app/(marketing)/press/page.tsx | 30 ++++++++ lib/legalSyntheticPost.ts | 3 +- lib/publicSitemap.ts | 1 + messages/en/index.ts | 2 + messages/en/marketing.ts | 2 + messages/en/metadata.json | 5 ++ messages/en/pages/press.json | 67 ++++++++++++++++++ tests/pages/press.test.tsx | 70 +++++++++++++++++++ tests/unit/legalSyntheticPost.test.ts | 1 + tests/unit/publicSitemap.test.ts | 1 + 11 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 app/(marketing)/press/page.tsx create mode 100644 messages/en/pages/press.json create mode 100644 tests/pages/press.test.tsx diff --git a/app/(marketing)/_components/LegalDocumentPage.tsx b/app/(marketing)/_components/LegalDocumentPage.tsx index ff42028..1fef0cc 100644 --- a/app/(marketing)/_components/LegalDocumentPage.tsx +++ b/app/(marketing)/_components/LegalDocumentPage.tsx @@ -91,7 +91,7 @@ export function legalPageMetadata( } /** - * Public Content page Template documents (`/privacy`, `/terms`, `/cookies`, `/kit`). + * Public Content page Template documents (`/privacy`, `/terms`, `/cookies`, `/kit`, `/press`). * * Figma: "Content page Template" (19003:23305) — ContentBanner guide * (22078:806964) + article column (19003:23574). Body stacks follow diff --git a/app/(marketing)/press/page.tsx b/app/(marketing)/press/page.tsx new file mode 100644 index 0000000..b8b9fd3 --- /dev/null +++ b/app/(marketing)/press/page.tsx @@ -0,0 +1,30 @@ +/** + * Figma: "Press / Breakpoint=1024+, State=Embargoed" (24810:39764) + * https://www.figma.com/design/agv0VBLiBlcnSAaiAORgPR/Community-Rule-System?node-id=24810-39764 + * + * Holds the press kit on the Content page Template until the embargo lifts. + * Live Figma (24810:39765) adds the release, screenshots and Boulder count. + */ +import type { Metadata } from "next"; +import messages from "../../../messages/en/index"; +import { legalPathForSlug } from "../../../lib/legalSyntheticPost"; +import { routeMetadata } from "../../../lib/siteMetadata"; +import LegalDocumentPage, { + legalPageMetadata, +} from "../_components/LegalDocumentPage"; + +const SLUG = "press" as const; +const PATH = legalPathForSlug(SLUG); + +export function generateMetadata(): Metadata { + return routeMetadata( + PATH, + legalPageMetadata(messages.metadata.press, messages.pages.press), + ); +} + +export default function PressPage() { + return ( + + ); +} diff --git a/lib/legalSyntheticPost.ts b/lib/legalSyntheticPost.ts index b5a8b3e..8985975 100644 --- a/lib/legalSyntheticPost.ts +++ b/lib/legalSyntheticPost.ts @@ -1,6 +1,6 @@ import type { BlogPost } from "./content"; -export type LegalDocumentSlug = "privacy" | "terms" | "cookies" | "kit"; +export type LegalDocumentSlug = "privacy" | "terms" | "cookies" | "kit" | "press"; export type LegalDocumentSection = { heading: string; @@ -24,6 +24,7 @@ const PATH_BY_SLUG: Record = { terms: "/terms", cookies: "/cookies", kit: "/kit", + press: "/press", }; export function legalPathForSlug(slug: LegalDocumentSlug): string { diff --git a/lib/publicSitemap.ts b/lib/publicSitemap.ts index ef8bd38..ee1aa61 100644 --- a/lib/publicSitemap.ts +++ b/lib/publicSitemap.ts @@ -12,6 +12,7 @@ const STATIC_PUBLIC_PATHS = [ "/blog", "/how-it-works", "/kit", + "/press", "/privacy", "/terms", "/cookies", diff --git a/messages/en/index.ts b/messages/en/index.ts index 765ddcd..65dda66 100644 --- a/messages/en/index.ts +++ b/messages/en/index.ts @@ -28,6 +28,7 @@ import useCasesCompletedRules from "./pages/useCasesCompletedRules.json"; import useCasesCompletedRule from "./pages/useCasesCompletedRule.json"; import howItWorks from "./pages/howItWorks.json"; import kit from "./pages/kit.json"; +import press from "./pages/press.json"; import privacy from "./pages/privacy.json"; import terms from "./pages/terms.json"; import cookies from "./pages/cookies.json"; @@ -114,6 +115,7 @@ export default { useCasesCompletedRule, howItWorks, kit, + press, privacy, terms, cookies, diff --git a/messages/en/marketing.ts b/messages/en/marketing.ts index 29f9dbc..31e55fc 100644 --- a/messages/en/marketing.ts +++ b/messages/en/marketing.ts @@ -40,6 +40,7 @@ import useCasesCompletedRules from "./pages/useCasesCompletedRules.json"; import useCasesCompletedRule from "./pages/useCasesCompletedRule.json"; import howItWorks from "./pages/howItWorks.json"; import kit from "./pages/kit.json"; +import press from "./pages/press.json"; import privacy from "./pages/privacy.json"; import terms from "./pages/terms.json"; import cookies from "./pages/cookies.json"; @@ -86,6 +87,7 @@ const marketingMessages = { useCasesCompletedRule, howItWorks, kit, + press, privacy, terms, cookies, diff --git a/messages/en/metadata.json b/messages/en/metadata.json index 773a6ea..68b3a5b 100644 --- a/messages/en/metadata.json +++ b/messages/en/metadata.json @@ -152,6 +152,11 @@ "description": "Everything your community needs to write its Rule together over five short meetings you already hold. Free for volunteer-run groups.", "keywords": ["kit", "facilitator guide", "office hours", "communityrule"] }, + "press": { + "title": "Press", + "description": "Press materials for CommunityRule, licensed CC BY-SA 4.0. Contact, embargo dates, and the story behind the tool.", + "keywords": ["press", "press kit", "communityrule", "media"] + }, "howItWorks": { "title": "When your community sits down to write its Rule", "description": "Sketch your Rule in CommunityRule, then make it your community's own over five short meetings.", diff --git a/messages/en/pages/press.json b/messages/en/pages/press.json new file mode 100644 index 0000000..f0742ca --- /dev/null +++ b/messages/en/pages/press.json @@ -0,0 +1,67 @@ +{ + "_comment": "Press page at /press. Figma Press / Embargoed (24810:39764). The release and Boulder count join this page when the embargo lifts at 6am Mountain time on 18 February 2027. Downloadable kit files are named without links until those files exist.", + "banner": { + "title": "Press", + "description": "Everything on this page is licensed CC BY-SA 4.0. Use it.", + "author": "Media Economies Design Lab", + "date": "2027-02-05" + }, + "updated": "Last updated February 5, 2027. Embargoed until 6am Mountain time on Thursday, February 18, 2027.", + "intro": [ + "The release and the Boulder count join this page when the embargo lifts. Until then they go only to journalists who have agreed to the embargo.", + "CU Boulder's news office sends the release to journalists under embargo on Tuesday, February 16. It goes public here at 6am Mountain time on Thursday, February 18, with the Boulder count of Rules written by kind of group." + ], + "sections": [ + { + "heading": "Contact", + "paragraphs": [ + "One contact for press is Nathan Schneider at [medlab@colorado.edu](mailto:medlab@colorado.edu).", + "Writing about CommunityRule? We can put you in touch with a pilot group. [Email the press contact](mailto:medlab@colorado.edu)." + ] + }, + { + "heading": "The story", + "paragraphs": [ + "We asked organizers from co-ops, mutual aid groups and open source projects around the world how their groups really work. The ones that lasted had settled four things early: how they decide, who belongs, how they talk, and what happens when they disagree. CommunityRule turns that finding into a Rule a group writes together, from one of 13 tested templates, with signals that show when a value is slipping. It is free and open source, built at the Media Economies Design Lab at CU Boulder. Volunteer-run groups can run a Rule-writing session for free. Larger organizations bring a facilitator, which keeps it free for everyone else." + ] + }, + { + "heading": "Dates", + "paragraphs": [ + "Launch: Thursday, February 18, 2027.", + "Boulder launch party: Saturday, February 20, 2027. Snow date Saturday, February 27.", + "Seminar: an online seminar with Metagov from January 11 to February 14, with a live capstone on February 17." + ] + }, + { + "heading": "Where does the finding come from?", + "paragraphs": [ + "From a UX research and service design study run inside the Media Economies Design Lab at the University of Colorado Boulder. We asked organizers from co-ops, mutual aid groups and open source projects how their groups really work. The groups that lasted had settled four things early. How they decide, who belongs, how they talk and what happens when they disagree." + ] + }, + { + "heading": "Who makes CommunityRule and what does it cost?", + "paragraphs": [ + "CommunityRule is made at the Media Economies Design Lab at the University of Colorado Boulder. It is free and open source. Volunteer-run groups run their own session with the kit. Larger organizations bring a facilitator, and that is what keeps the kit free." + ] + }, + { + "heading": "Who can see a group's Rule?", + "paragraphs": [ + "Only the people you share it with. Rules are private by default. A Rule is public and featured only when a community asks us in writing." + ] + }, + { + "heading": "Does CommunityRule use AI?", + "paragraphs": [ + "No. When you choose community details such as size or organization type, we use those answers to reorder templates and methods. Ranking is a matching table we maintain. It is not an AI or machine-learning model, it does not train on your drafts, and we do not send your data to an AI service." + ] + }, + { + "heading": "Who can we interview?", + "paragraphs": [ + "Write to [medlab@colorado.edu](mailto:medlab@colorado.edu). We can put you in touch with a pilot group." + ] + } + ] +} diff --git a/tests/pages/press.test.tsx b/tests/pages/press.test.tsx new file mode 100644 index 0000000..60ccc39 --- /dev/null +++ b/tests/pages/press.test.tsx @@ -0,0 +1,70 @@ +import { describe, expect, test, vi } from "vitest"; +import { screen } from "@testing-library/react"; +import { renderWithProviders as render } from "../utils/test-utils"; +import LegalDocumentPage from "../../app/(marketing)/_components/LegalDocumentPage"; +import { legalPathForSlug } from "../../lib/legalSyntheticPost"; +import messages from "../../messages/en/index"; + +vi.mock("../../lib/requestSiteOrigin", () => ({ + getRequestSiteOrigin: async () => "https://communityrule.info", +})); + +vi.mock("../../app/components/sections/ContentBanner", () => ({ + default: ({ post, variant, updatedLabel }) => ( +
+

{post.frontmatter.title}

+

{post.frontmatter.description}

+ {updatedLabel ? ( +
+ {post.frontmatter.author} + {updatedLabel} +
+ ) : null} +
+ ), +})); + +async function renderPressPage() { + const page = messages.pages.press; + const ui = await LegalDocumentPage({ + slug: "press", + path: legalPathForSlug("press"), + page, + }); + return render(ui); +} + +describe("press page", () => { + test("holds embargoed press materials, a contact, and the story", async () => { + await renderPressPage(); + const page = messages.pages.press; + + expect(screen.getByTestId("content-banner")).toHaveAttribute( + "data-variant", + "guide", + ); + expect( + screen.getByRole("heading", { level: 1, name: page.banner.title }), + ).toBeInTheDocument(); + expect(screen.getByText(page.banner.description)).toBeInTheDocument(); + expect( + screen.getByText(/when the embargo lifts/), + ).toBeInTheDocument(); + expect( + screen.getByRole("heading", { level: 2, name: "Contact" }), + ).toBeInTheDocument(); + expect( + screen.getByRole("heading", { level: 2, name: "The story" }), + ).toBeInTheDocument(); + expect( + screen.getByRole("heading", { level: 2, name: "Does CommunityRule use AI?" }), + ).toBeInTheDocument(); + expect( + screen.getAllByRole("link", { name: "medlab@colorado.edu" })[0], + ).toHaveAttribute("href", "mailto:medlab@colorado.edu"); + expect( + screen.getByRole("link", { name: "Email the press contact" }), + ).toHaveAttribute("href", "mailto:medlab@colorado.edu"); + expect(screen.getByText(/CC BY-SA 4.0/)).toBeInTheDocument(); + }); +}); diff --git a/tests/unit/legalSyntheticPost.test.ts b/tests/unit/legalSyntheticPost.test.ts index 87a0036..3f7787f 100644 --- a/tests/unit/legalSyntheticPost.test.ts +++ b/tests/unit/legalSyntheticPost.test.ts @@ -10,6 +10,7 @@ describe("legalSyntheticPost", () => { expect(legalPathForSlug("terms")).toBe("/terms"); expect(legalPathForSlug("cookies")).toBe("/cookies"); expect(legalPathForSlug("kit")).toBe("/kit"); + expect(legalPathForSlug("press")).toBe("/press"); }); it("builds a guide-shaped post from page messages", () => { diff --git a/tests/unit/publicSitemap.test.ts b/tests/unit/publicSitemap.test.ts index 21b254b..6e1da48 100644 --- a/tests/unit/publicSitemap.test.ts +++ b/tests/unit/publicSitemap.test.ts @@ -17,6 +17,7 @@ describe("buildPublicSitemap", () => { expect(urls).not.toContain(sitemapUrl("/use-cases")); expect(urls).toContain(sitemapUrl("/how-it-works")); expect(urls).toContain(sitemapUrl("/kit")); + expect(urls).toContain(sitemapUrl("/press")); expect(urls).toContain(sitemapUrl("/privacy")); expect(urls).toContain(sitemapUrl("/terms")); expect(urls).toContain(sitemapUrl("/cookies")); -- 2.53.0 From 072e5362f555daa939e5702565ddddca937dd111 Mon Sep 17 00:00:00 2001 From: adilallo <39313955+adilallo@users.noreply.github.com> Date: Fri, 20 Nov 2026 15:36:06 -0700 Subject: [PATCH 3/5] Hold /privacy behind a flag until counsel reads it, and fix leftover legal and email copy. --- .env.example | 8 +- app/(admin)/layout.tsx | 3 +- app/(app)/layout.tsx | 3 +- app/(app)/login/LoginPageClient.tsx | 72 ++++++++++++ app/(app)/login/page.tsx | 64 +---------- app/(dev)/layout.tsx | 3 +- .../_components/LegalDocumentPage.tsx | 5 +- app/(marketing)/layout.tsx | 3 +- app/(marketing)/privacy/page.tsx | 4 + app/(marketing-case-study)/layout.tsx | 3 +- app/api/organizer-inquiry/route.ts | 7 +- app/api/user/email-change/request/route.ts | 2 +- app/components/modals/Login/LoginForm.tsx | 21 ++-- app/components/navigation/Footer.tsx | 16 ++- .../navigation/FooterWithOrigin.tsx | 8 +- app/contexts/AuthModalContext.tsx | 9 +- docs/guides/ops-backend-deploy.md | 13 ++- docs/guides/ops-runbook.md | 5 +- docs/privacy-policy-facts.md | 7 +- lib/privacyPolicyEnabled.ts | 17 +++ lib/publicSitemap.ts | 5 +- lib/server/magicLinkMail.ts | 105 +++++++++++++----- lib/server/mail.ts | 29 +++-- lib/server/mailLegalFooter.ts | 30 +++++ lib/server/ruleFollowUpMail.ts | 16 +-- lib/server/ruleStakeholderInviteMail.ts | 18 +-- lib/useCaseTemplateDuplicate.ts | 2 +- messages/en/metadata.json | 20 ++-- messages/en/pages/cookies.json | 13 ++- messages/en/pages/monitor.json | 2 +- messages/en/pages/privacy.json | 6 +- tests/components/Footer.test.tsx | 12 +- tests/components/LoginForm.test.tsx | 16 ++- tests/mocks/navigation.ts | 3 + tests/pages/legal.test.tsx | 60 ++++++++-- tests/unit/magicLinkMail.test.ts | 47 +++++++- tests/unit/mail.test.ts | 14 ++- tests/unit/organizerInquiryPostRoute.test.ts | 2 + tests/unit/privacyPolicyEnabled.test.ts | 40 +++++++ tests/unit/publicSitemap.test.ts | 20 ++++ tests/unit/useCaseTemplateDuplicate.test.ts | 2 +- .../unit/userEmailChangeRequestRoute.test.ts | 1 + vitest.setup.ts | 3 + 43 files changed, 548 insertions(+), 191 deletions(-) create mode 100644 app/(app)/login/LoginPageClient.tsx create mode 100644 lib/privacyPolicyEnabled.ts create mode 100644 lib/server/mailLegalFooter.ts create mode 100644 tests/unit/privacyPolicyEnabled.test.ts diff --git a/.env.example b/.env.example index 60f8c28..8d6f17e 100644 --- a/.env.example +++ b/.env.example @@ -13,7 +13,13 @@ SESSION_SECRET="dev-only-change-me-16chars-min" # CLOUDRON_MAIL_SMTP_PASSWORD= # Leave mail vars unset in dev to log the magic-link verify URL to the server console instead of sending email. -SMTP_FROM="Community Rule " +SMTP_FROM="CommunityRule " + +# /privacy. Unset or any value other than `true` is off (404, no footer/login/email links). +# Staging: `true`. Production stays off until university counsel has read the policy. +# ENABLE_PRIVACY_POLICY is the Cloudron runtime switch. The NEXT_PUBLIC_ alias bakes at image build. +# ENABLE_PRIVACY_POLICY=true +# NEXT_PUBLIC_ENABLE_PRIVACY_POLICY=true # CR-107: inbox for Ask an organizer form submissions (requires CLOUDRON_MAIL_SMTP_* in production). ORGANIZER_INQUIRY_TO= diff --git a/app/(admin)/layout.tsx b/app/(admin)/layout.tsx index bac82f4..a506100 100644 --- a/app/(admin)/layout.tsx +++ b/app/(admin)/layout.tsx @@ -6,6 +6,7 @@ import { MessagesProvider } from "../contexts/MessagesContext"; import { AuthModalProvider } from "../contexts/AuthModalContext"; import messages from "../../messages/en/index"; import { MAIN_CONTENT_ID } from "../../lib/mainContent"; +import { isPrivacyPolicyEnabled } from "../../lib/privacyPolicyEnabled"; import { NO_INDEX_ROBOTS } from "../../lib/siteMetadata"; export const metadata: Metadata = { @@ -21,7 +22,7 @@ export const metadata: Metadata = { export default function AdminLayout({ children }: { children: ReactNode }) { return ( - + diff --git a/app/(app)/layout.tsx b/app/(app)/layout.tsx index 56d66c1..a10002a 100644 --- a/app/(app)/layout.tsx +++ b/app/(app)/layout.tsx @@ -6,6 +6,7 @@ import { MessagesProvider } from "../contexts/MessagesContext"; import { AuthModalProvider } from "../contexts/AuthModalContext"; import messages from "../../messages/en/index"; import { MAIN_CONTENT_ID } from "../../lib/mainContent"; +import { isPrivacyPolicyEnabled } from "../../lib/privacyPolicyEnabled"; import { NO_INDEX_ROBOTS } from "../../lib/siteMetadata"; export const metadata: Metadata = { @@ -28,7 +29,7 @@ export const metadata: Metadata = { export default function AppLayout({ children }: { children: ReactNode }) { return ( - + diff --git a/app/(app)/login/LoginPageClient.tsx b/app/(app)/login/LoginPageClient.tsx new file mode 100644 index 0000000..d2459e7 --- /dev/null +++ b/app/(app)/login/LoginPageClient.tsx @@ -0,0 +1,72 @@ +"use client"; + +import { Suspense } from "react"; +import Link from "next/link"; +import { useRouter } from "next/navigation"; +import { useTranslation } from "../../contexts/MessagesContext"; +import Login from "../../components/modals/Login"; +import LoginForm from "../../components/modals/Login/LoginForm"; + +const loginPageBgClass = + "min-h-[100dvh] bg-[var(--color-surface-invert-brand-primary)]"; + +function LoginLoadingFallback() { + const t = useTranslation("pages.login"); + return ( +
+

+ {t("loadingFallback")} +

+
+ ); +} + +function LoginWithSearchParams({ + privacyEnabled, +}: { + privacyEnabled: boolean; +}) { + const router = useRouter(); + const t = useTranslation("pages.login"); + const closeToHome = () => { + router.push("/"); + }; + + return ( +
+ + {t("backToHome")} + + } + > + + +
+ ); +} + +/** + * Full-page login shell for magic-link **error redirects** (`?error=*`) and direct `/login` visits. + * Header **Log in** uses `AuthModalProvider` instead; this route stays for verify failures and bookmarks. + */ +export default function LoginPageClient({ + privacyEnabled, +}: { + privacyEnabled: boolean; +}) { + return ( + }> + + + ); +} diff --git a/app/(app)/login/page.tsx b/app/(app)/login/page.tsx index d9f0241..72bebdc 100644 --- a/app/(app)/login/page.tsx +++ b/app/(app)/login/page.tsx @@ -1,64 +1,6 @@ -"use client"; - -import { Suspense } from "react"; -import Link from "next/link"; -import { useRouter } from "next/navigation"; -import { useTranslation } from "../../contexts/MessagesContext"; -import Login from "../../components/modals/Login"; -import LoginForm from "../../components/modals/Login/LoginForm"; - -const loginPageBgClass = - "min-h-[100dvh] bg-[var(--color-surface-invert-brand-primary)]"; - -function LoginLoadingFallback() { - const t = useTranslation("pages.login"); - return ( -
-

- {t("loadingFallback")} -

-
- ); -} - -/** - * Full-page login shell for magic-link **error redirects** (`?error=*`) and direct `/login` visits. - * Header **Log in** uses `AuthModalProvider` instead; this route stays for verify failures and bookmarks. - */ -function LoginWithSearchParams() { - const router = useRouter(); - const t = useTranslation("pages.login"); - const closeToHome = () => { - router.push("/"); - }; - - return ( -
- - {t("backToHome")} - - } - > - - -
- ); -} +import { isPrivacyPolicyEnabled } from "../../../lib/privacyPolicyEnabled"; +import LoginPageClient from "./LoginPageClient"; export default function LoginPage() { - return ( - }> - - - ); + return ; } diff --git a/app/(dev)/layout.tsx b/app/(dev)/layout.tsx index 7383768..d71bee0 100644 --- a/app/(dev)/layout.tsx +++ b/app/(dev)/layout.tsx @@ -5,6 +5,7 @@ import { MessagesProvider } from "../contexts/MessagesContext"; import { AuthModalProvider } from "../contexts/AuthModalContext"; import messages from "../../messages/en/index"; import { MAIN_CONTENT_ID } from "../../lib/mainContent"; +import { isPrivacyPolicyEnabled } from "../../lib/privacyPolicyEnabled"; import { NO_INDEX_ROBOTS } from "../../lib/siteMetadata"; export const metadata: Metadata = { @@ -18,7 +19,7 @@ export default function DevLayout({ children }: { children: ReactNode }) { } return ( - +
- + {/* * Same session-aware shell as `(app)` / `(admin)`: `ConditionalNavigation` * reads the cookie behind Suspense so the static page shell can prerender diff --git a/app/(marketing)/privacy/page.tsx b/app/(marketing)/privacy/page.tsx index 35efafc..11e2b86 100644 --- a/app/(marketing)/privacy/page.tsx +++ b/app/(marketing)/privacy/page.tsx @@ -3,8 +3,10 @@ * https://www.figma.com/design/agv0VBLiBlcnSAaiAORgPR/Community-Rule-System?node-id=19003-23305 */ import type { Metadata } from "next"; +import { notFound } from "next/navigation"; import messages from "../../../messages/en/index"; import { legalPathForSlug } from "../../../lib/legalSyntheticPost"; +import { isPrivacyPolicyEnabled } from "../../../lib/privacyPolicyEnabled"; import { routeMetadata } from "../../../lib/siteMetadata"; import LegalDocumentPage, { legalPageMetadata, @@ -14,6 +16,7 @@ const SLUG = "privacy" as const; const PATH = legalPathForSlug(SLUG); export function generateMetadata(): Metadata { + if (!isPrivacyPolicyEnabled()) notFound(); return routeMetadata( PATH, legalPageMetadata(messages.metadata.privacy, messages.pages.privacy), @@ -21,6 +24,7 @@ export function generateMetadata(): Metadata { } export default function PrivacyPage() { + if (!isPrivacyPolicyEnabled()) notFound(); return ( - +
void; /** Sent-state Close, and the dialog chrome close. */ @@ -120,6 +122,7 @@ export type LoginFormProps = { export default function LoginForm({ variant = "default", magicLinkNextPath, + privacyEnabled = false, onDismiss, onClose, }: LoginFormProps) { @@ -365,13 +368,17 @@ export default function LoginForm({ > {tFooter("legal.termsOfService")} - {t("legalAnd")} - - {tFooter("legal.privacyPolicy")} - + {privacyEnabled ? ( + <> + {t("legalAnd")} + + {tFooter("legal.privacyPolicy")} + + + ) : null} {t("legalSuffix")}

diff --git a/app/components/navigation/Footer.tsx b/app/components/navigation/Footer.tsx index 0fa2402..4ac9bc3 100644 --- a/app/components/navigation/Footer.tsx +++ b/app/components/navigation/Footer.tsx @@ -13,7 +13,13 @@ import { PRODUCTION_SITE_ORIGIN } from "../../../lib/siteMetadata"; * Tiers: smallest viewports (below `md`), `md` through `lg`, `lg` and up. * Matches `--breakpoint-md: 640px`, `--breakpoint-lg: 1024px` in `app/tailwind.css`. */ -const Footer = memo(({ siteOrigin = PRODUCTION_SITE_ORIGIN }: { siteOrigin?: string }) => { +const Footer = memo(({ + siteOrigin = PRODUCTION_SITE_ORIGIN, + privacyEnabled = false, +}: { + siteOrigin?: string; + privacyEnabled?: boolean; +}) => { const t = useTranslation("footer"); const tChrome = useTranslation("controlsChrome"); @@ -213,9 +219,11 @@ const Footer = memo(({ siteOrigin = PRODUCTION_SITE_ORIGIN }: { siteOrigin?: str {t("takeaway")} - - {t("legal.privacyPolicy")} - + {privacyEnabled ? ( + + {t("legal.privacyPolicy")} + + ) : null} {t("legal.termsOfService")} diff --git a/app/components/navigation/FooterWithOrigin.tsx b/app/components/navigation/FooterWithOrigin.tsx index bdb94a9..46175d0 100644 --- a/app/components/navigation/FooterWithOrigin.tsx +++ b/app/components/navigation/FooterWithOrigin.tsx @@ -1,8 +1,14 @@ import Footer from "./Footer"; +import { isPrivacyPolicyEnabled } from "../../../lib/privacyPolicyEnabled"; import { getRequestSiteOrigin } from "../../../lib/requestSiteOrigin"; /** Footer JSON-LD uses the request origin, same host as the page canonical. */ export default async function FooterWithOrigin() { const siteOrigin = await getRequestSiteOrigin(); - return