Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
🐛 Exclude soft-deleted polls from access checks and notification recipients (#2607)
Luke Vella79a27ad6f44f
diff --git a/apps/web/src/features/notifications/data.ts b/apps/web/src/features/notifications/data.tsindex c7156fd0c..10d0c5290 100644--- a/apps/web/src/features/notifications/data.ts+++ b/apps/web/src/features/notifications/data.ts@@ -47,10 +47,15 @@ export async function getNotificationRecipient({}): Promise<NotificationRecipient | null> {const poll = await prisma.poll.findUnique({where: { id: pollId },- select: { userId: true, muted: true },+ select: { userId: true, muted: true, deleted: true },});- if (!poll?.userId || poll.userId === excludeUserId || poll.muted) {+ if (+ !poll?.userId ||+ poll.deleted ||+ poll.userId === excludeUserId ||+ poll.muted+ ) {return null;}diff --git a/apps/web/src/features/poll/data.ts b/apps/web/src/features/poll/data.tsindex a93201f67..2ef93fb65 100644--- a/apps/web/src/features/poll/data.ts+++ b/apps/web/src/features/poll/data.ts@@ -254,8 +254,14 @@ export async function canUserManagePoll(poll: {userId?: string | null;spaceId?: string | null;+ deleted?: boolean;},) {+ if (poll.deleted) {+ // A deleted poll cannot be managed by anyone+ return false;+ }+if (poll.userId && poll.userId === user.id) {// user is ownerreturn true;@@ -284,6 +290,7 @@ export const hasPollAdminAccess = async (pollId: string, userId: string) => {const poll = await prisma.poll.findFirst({where: {id: pollId,+ deleted: false,OR: [{ userId: userId }, { space: { members: { some: { userId } } } }],},select: {