Hack page: let admins delete hacks, with an optional redirect (#108)
Some checks failed
Deploy Supabase Migrations to Production / migrate (push) Has been cancelled

This commit is contained in:
Jared Schoeny
2026-10-06 15:57:54 -06:00
committed by GitHub
parent 039432b073
commit f103a0cb65
18 changed files with 417 additions and 52 deletions

View File

@@ -72,7 +72,7 @@ export async function collectRecipients(supabase: SupabaseClient<Database>): Pro
for (let offset = 0; ; offset += pageSize) {
const { data, error } = await supabase.from("hacks")
.select("slug,created_by,current_patch,patch_url,approved")
.eq("is_archive", false).order("slug").range(offset, offset + pageSize - 1);
.eq("is_archive", false).is("deleted_at", null).order("slug").range(offset, offset + pageSize - 1);
if (error) throw new Error(`Cannot load hacks: ${error.message}`);
if (!data) throw new Error("No response when loading hacks.");
for (const hack of data) {

View File

@@ -155,6 +155,7 @@ test("recipient selection paginates, excludes empty drafts, and deduplicates cre
const url = new URL(new Request(input, init).url);
if (url.pathname === "/rest/v1/hacks") {
assert.equal(url.searchParams.get("is_archive"), "eq.false");
assert.equal(url.searchParams.get("deleted_at"), "is.null");
const columns = new Set(["slug", "created_by", "current_patch", "patch_url", "approved"]);
const unknown = url.searchParams.get("select")?.split(",").find((column) => !columns.has(column));
if (unknown) return Response.json({ message: `column hacks.${unknown} does not exist`, code: "42703" }, { status: 400 });