diff --git a/src/pages/guestbook.astro b/src/pages/guestbook.astro index ce9b60d3..1b281217 100644 --- a/src/pages/guestbook.astro +++ b/src/pages/guestbook.astro @@ -1,5 +1,13 @@ --- -import { Guestbook as GuestbookDB, count, db, desc, eq } from "astro:db"; +import { + Guestbook as GuestbookDB, + count, + db, + desc, + eq, + isNull, + or, +} from "astro:db"; import { Icon } from "src/components/Icon/Icon"; import Center from "../components/Center.astro"; @@ -26,7 +34,7 @@ const entriesPerPage = const entryCount = await db .select({ count: count() }) .from(GuestbookDB) - .where(eq(GuestbookDB.isSpam, false)); + .where(or(eq(GuestbookDB.isSpam, false), isNull(GuestbookDB.isSpam))); const totalEntries = entryCount[0].count; // Calculate total pages accounting for one less entry on first page const remainingEntries = Math.max(0, totalEntries - 1); // Subtract one for composer @@ -75,7 +83,7 @@ if (Astro.request.method === "POST") { const guestbook = await db .select() .from(GuestbookDB) - .where(eq(GuestbookDB.isSpam, false)) + .where(or(eq(GuestbookDB.isSpam, false), isNull(GuestbookDB.isSpam))) .orderBy(desc(GuestbookDB.timestamp)) .limit(entriesPerPage) .offset(offset);