Page management, step 2: the core pages as sections

Migrations 081 and 082: Feedback, Request, QR codes, Give, Privacy and
Terms become pages of sections. Their forms and embeds are section types
any page can use; Give's words and all of Privacy and Terms become blocks.
The privacy contact email is written into the policy and its setting goes.
Core pages keep their address and can't be deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aidan Dona 2026-10-16 23:24:34 -05:00
parent 1342691f49
commit f33c0008fe
27 changed files with 298 additions and 645 deletions

View file

@ -33,6 +33,12 @@ const sectionsChild = {
"events",
"timeline",
"people_directory",
// What used to be whole pages (081).
"feedback_form",
"request_form",
"data_request_form",
"giving",
"qr_maker",
]),
text("scope_id"),
enumeration("event_type", ["retreat", "class", "workshop", "meeting", "other"]),
@ -62,9 +68,10 @@ const sectionsChild = {
};
/* Pages the site draws in code (src/pages/fixedPages.ts): they can be
renamed, moved, hidden or disabled, never deleted. */
export const FIXED_PAGES = ["home", "give", "feedback", "request", "qr", "privacy", "terms"];
/* Pages the site's own code links to (the footer's defaults, the
Request buttons, the privacy notice, Tools → QR codes): renamed,
hidden or disabled, but never moved or deleted. */
export const CORE_PAGES = { home: "/", give: "/give", feedback: "/feedback", request: "/request", qr: "/qr", privacy: "/privacy", terms: "/terms" };
/* Addresses a page can't take: the admin, the API, the uploads, the
records' own pages and the account pages. */
@ -81,7 +88,9 @@ function checkPage(db, id) {
if (first && RESERVED.includes(first)) {
throw new HttpError(422, "Validation failed", { path: `/${first} belongs to another part of the site. Pick another address.` });
}
if (id === "home" && page.path !== "/") throw new HttpError(422, "Validation failed", { path: "The front page stays at /." });
if (CORE_PAGES[id] && page.path !== CORE_PAGES[id]) {
throw new HttpError(422, "Validation failed", { path: `The site links to this page at ${CORE_PAGES[id]}, so its address stays.` });
}
if (id !== "home" && page.path === "/") throw new HttpError(422, "Validation failed", { path: "/ is the front page." });
}
@ -93,7 +102,7 @@ export const pages = {
idColumn: "id",
idKind: "slug",
concurrency: "updated_at",
undeletable: FIXED_PAGES,
undeletable: Object.keys(CORE_PAGES),
list: {
columns: ["title", "path", "is_hidden", "is_disabled", "updated_at"],