mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-02 19:56:05 +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 }),
|
trpc.polls.comments.list.prefetch({ pollId: params.urlId }),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!poll || poll.deleted) {
|
if (!poll || poll.deleted || poll.user?.banned) {
|
||||||
notFound();
|
notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ export async function generateMetadata({
|
||||||
user: {
|
user: {
|
||||||
select: {
|
select: {
|
||||||
name: true,
|
name: true,
|
||||||
|
banned: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -63,7 +64,7 @@ export async function generateMetadata({
|
||||||
|
|
||||||
const { t } = await getTranslation(locale);
|
const { t } = await getTranslation(locale);
|
||||||
|
|
||||||
if (!poll || poll.deleted) {
|
if (!poll || poll.deleted || poll.user?.banned) {
|
||||||
notFound();
|
notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { PollStatus, User, VoteType } from "@rallly/database";
|
import type { PollStatus, VoteType } from "@rallly/database";
|
||||||
|
|
||||||
export type GetPollApiResponse = {
|
export type GetPollApiResponse = {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -6,7 +6,13 @@ export type GetPollApiResponse = {
|
||||||
location: string | null;
|
location: string | null;
|
||||||
description: string | null;
|
description: string | null;
|
||||||
options: { id: string; startTime: Date; duration: number }[];
|
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;
|
timeZone: string | null;
|
||||||
adminUrlId: string;
|
adminUrlId: string;
|
||||||
status: PollStatus;
|
status: PollStatus;
|
||||||
|
|
|
@ -446,7 +446,15 @@ export const polls = router({
|
||||||
startTime: "asc",
|
startTime: "asc",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
user: true,
|
user: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
name: true,
|
||||||
|
email: true,
|
||||||
|
image: true,
|
||||||
|
banned: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
userId: true,
|
userId: true,
|
||||||
guestId: true,
|
guestId: true,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
|
|
Loading…
Add table
Reference in a new issue