From 6a302bb14b73311d8a8d6aa9d456fb55c42bf09f Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sat, 26 Feb 2022 22:12:05 +0200 Subject: [PATCH] Validate group is full when matching up --- app/routes/play/looking.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/routes/play/looking.tsx b/app/routes/play/looking.tsx index aa9c8b091..d279551e3 100644 --- a/app/routes/play/looking.tsx +++ b/app/routes/play/looking.tsx @@ -147,6 +147,14 @@ export const action: ActionFunction = async ({ request, context }) => { const groupToMatchUpWith = await LFGGroup.findById(data.targetGroupId); validate(groupToMatchUpWith, "Invalid targetGroupId"); validate(ownGroup.status === "LOOKING", "Group not looking"); + validate( + groupToMatchUpWith.members.length === LFG_GROUP_FULL_SIZE, + "Group to match up with not full" + ); + validate( + ownGroup.members.length === LFG_GROUP_FULL_SIZE, + "Own group not full" + ); // fail silently if already matched up or group stopped looking if (groupToMatchUpWith.status !== "LOOKING") {