Fail MATCH_UP if one group already matched up

This commit is contained in:
Kalle
2022-02-24 09:58:32 +02:00
parent d3dc68592e
commit eb1052d763

View File

@@ -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],