diff --git a/app/features/tournament/actions/to.$id.admin.server.ts b/app/features/tournament/actions/to.$id.admin.server.ts index 2c29f0f0b..84722f5e3 100644 --- a/app/features/tournament/actions/to.$id.admin.server.ts +++ b/app/features/tournament/actions/to.$id.admin.server.ts @@ -13,6 +13,7 @@ import { tournamentFromDB, } from "~/features/tournament-bracket/core/Tournament.server"; import { deleteSub } from "~/features/tournament-subs/queries/deleteSub.server"; +import * as UserRepository from "~/features/user-page/UserRepository.server"; import invariant from "~/utils/invariant"; import { logger } from "~/utils/logger"; import { @@ -64,6 +65,10 @@ export const action: ActionFunction = async ({ request, params }) => { !tournament.teamMemberOfByUser({ id: data.userId }), "User already on a team", ); + errorToastIfFalsy( + (await UserRepository.findLeanById(data.userId))?.friendCode, + "User has no friend code set", + ); await TournamentTeamRepository.create({ ownerInGameName: await inGameNameIfNeeded({ @@ -237,6 +242,11 @@ export const action: ActionFunction = async ({ request, params }) => { "User trying to be added currently has an active ban from sendou.ink", ); + errorToastIfFalsy( + (await UserRepository.findLeanById(data.userId))?.friendCode, + "User has no friend code set", + ); + joinTeam({ userId: data.userId, newTeamId: team.id,