Check that TO added user to team is not banned

This commit is contained in:
Kalle 2024-05-14 20:44:08 +03:00
parent 09c0ed322b
commit 6a188a1d69

View File

@ -39,6 +39,7 @@ import { useTournament } from "./to.$id";
import { findMapPoolByTeamId } from "~/features/tournament-bracket/queries/findMapPoolByTeamId.server";
import { Input } from "~/components/Input";
import { logger } from "~/utils/logger";
import { userIsBanned } from "~/features/ban/core/banned.server";
export const action: ActionFunction = async ({ request, params }) => {
const user = await requireUserId(request);
@ -211,6 +212,11 @@ export const action: ActionFunction = async ({ request, params }) => {
validate(!previousTeam, "User is already on a team");
}
validate(
!userIsBanned(data.userId),
"User trying to be added currently has an active ban from sendou.ink",
);
joinTeam({
userId: data.userId,
newTeamId: team.id,