🐛 Don’t return metadata if poll is deleted

This commit is contained in:
Luke Vella 2025-03-03 18:13:38 +00:00
parent b6fc95b03b
commit a8bcde45b3
No known key found for this signature in database
GPG key ID: 469CAD687F0D784C
2 changed files with 3 additions and 2 deletions

View file

@ -20,7 +20,7 @@ export default async function Layout({
trpc.polls.comments.list.prefetch({ pollId: params.urlId }), trpc.polls.comments.list.prefetch({ pollId: params.urlId }),
]); ]);
if (!poll) { if (!poll || poll.deleted) {
notFound(); notFound();
} }

View file

@ -52,6 +52,7 @@ export async function generateMetadata({
select: { select: {
id: true, id: true,
title: true, title: true,
deleted: true,
user: { user: {
select: { select: {
name: true, name: true,
@ -62,7 +63,7 @@ export async function generateMetadata({
const { t } = await getTranslation(locale); const { t } = await getTranslation(locale);
if (!poll) { if (!poll || poll.deleted) {
notFound(); notFound();
} }