Skip to content

Commit 2d758cb

Browse files
committed
Disallow stale location
1 parent bc06126 commit 2d758cb

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/components/queue/CreateTicketForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,10 @@ const CreateTicketForm = (props: CreateTicketFormProps) => {
177177
if (!ticket) {
178178
toast({
179179
title: 'Error',
180-
description: 'Could not create ticket. You may already have a ticket open.',
180+
description: 'Could not create ticket. You may already have a ticket open. If not, refresh and try again.',
181181
status: 'error',
182182
position: 'top-right',
183-
duration: 3000,
183+
duration: 5000,
184184
isClosable: true,
185185
});
186186
return;

src/server/trpc/router/ticket.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ export const ticketRouter = router({
8282
return;
8383
}
8484

85+
const location = await ctx.prisma.location.findUnique({
86+
where: {
87+
id: input.locationId,
88+
},
89+
});
90+
91+
if (!location || !location.isActive) {
92+
return;
93+
}
94+
8595
const publicTicketsEnabled = await ctx.prisma.settings.findUnique({
8696
where: {
8797
setting: SiteSettings.ARE_PUBLIC_TICKETS_ENABLED,

0 commit comments

Comments
 (0)