mirror of
https://github.com/lukevella/rallly.git
synced 2025-04-28 17:56:37 +02:00
✨ Block access to all polls for banned user (#1606)
This commit is contained in:
parent
7697270cf5
commit
57406b8843
4 changed files with 20 additions and 5 deletions
|
@ -20,7 +20,7 @@ export default async function Layout({
|
|||
trpc.polls.comments.list.prefetch({ pollId: params.urlId }),
|
||||
]);
|
||||
|
||||
if (!poll || poll.deleted) {
|
||||
if (!poll || poll.deleted || poll.user?.banned) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ export async function generateMetadata({
|
|||
user: {
|
||||
select: {
|
||||
name: true,
|
||||
banned: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -63,7 +64,7 @@ export async function generateMetadata({
|
|||
|
||||
const { t } = await getTranslation(locale);
|
||||
|
||||
if (!poll || poll.deleted) {
|
||||
if (!poll || poll.deleted || poll.user?.banned) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { PollStatus, User, VoteType } from "@rallly/database";
|
||||
import type { PollStatus, VoteType } from "@rallly/database";
|
||||
|
||||
export type GetPollApiResponse = {
|
||||
id: string;
|
||||
|
@ -6,7 +6,13 @@ export type GetPollApiResponse = {
|
|||
location: string | null;
|
||||
description: string | null;
|
||||
options: { id: string; startTime: Date; duration: number }[];
|
||||
user: User | null;
|
||||
user: {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string | null;
|
||||
image: string | null;
|
||||
banned: boolean;
|
||||
} | null;
|
||||
timeZone: string | null;
|
||||
adminUrlId: string;
|
||||
status: PollStatus;
|
||||
|
|
|
@ -446,7 +446,15 @@ export const polls = router({
|
|||
startTime: "asc",
|
||||
},
|
||||
},
|
||||
user: true,
|
||||
user: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
email: true,
|
||||
image: true,
|
||||
banned: true,
|
||||
},
|
||||
},
|
||||
userId: true,
|
||||
guestId: true,
|
||||
deleted: true,
|
||||
|
|
Loading…
Add table
Reference in a new issue