From eb1052d763333902b09eee2994c80ff02dbecf85 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Thu, 24 Feb 2022 09:58:32 +0200 Subject: [PATCH] Fail MATCH_UP if one group already matched up --- app/routes/play/looking.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/routes/play/looking.tsx b/app/routes/play/looking.tsx index 521db2a35..f1148e6b2 100644 --- a/app/routes/play/looking.tsx +++ b/app/routes/play/looking.tsx @@ -140,6 +140,10 @@ export const action: ActionFunction = async ({ request, context }) => { validateIsGroupAdmin(); const groupToMatchUpWith = await LFGGroup.findById(data.targetGroupId); validate(groupToMatchUpWith, "Invalid targetGroupId"); + validate(!ownGroup.matchId, "Already matched up"); + + // fail silently if already matched up + if (groupToMatchUpWith.matchId) break; await LFGGroup.matchUp({ groupIds: [ownGroup.id, data.targetGroupId],