From 4e49555a638208c2b205bcefd513fffea229ffbb Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Fri, 4 Mar 2022 22:33:49 +0200 Subject: [PATCH] Validate user isn't in group before continuing --- app/routes/play/index.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/routes/play/index.tsx b/app/routes/play/index.tsx index 96908da0b..234cfc715 100644 --- a/app/routes/play/index.tsx +++ b/app/routes/play/index.tsx @@ -19,6 +19,7 @@ import { makeTitle, parseRequestFormData, requireUser, + validate, } from "~/utils"; import * as LFGGroup from "~/models/LFGGroup.server"; import * as Skill from "~/models/Skill.server"; @@ -51,6 +52,9 @@ export const action: ActionFunction = async ({ request, context }) => { }); const user = requireUser(context); + const ids = await LFGGroup.activeUserIds(); + validate(!ids.has(user.id), "Already in an active group"); + switch (data._action) { case "CREATE_LFG_GROUP": { const getRanked = () => {