mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-11 05:36:10 -05:00
Add backend check for joining two tournament teams Closes #1666
This commit is contained in:
@@ -99,11 +99,10 @@ export const action: ActionFunction = async ({ request, params }) => {
|
||||
|
||||
const tournamentId = tournamentIdFromParams(params);
|
||||
const tournament = await tournamentFromDB({ tournamentId, user });
|
||||
const hasStarted = hasTournamentStarted(tournamentId);
|
||||
const event = notFoundIfFalsy(findByIdentifier(tournamentId));
|
||||
|
||||
validate(
|
||||
!hasStarted,
|
||||
tournament.ctx.inProgressBrackets.length === 0,
|
||||
"Tournament has started, cannot make edits to registration",
|
||||
);
|
||||
|
||||
@@ -122,6 +121,10 @@ export const action: ActionFunction = async ({ request, params }) => {
|
||||
});
|
||||
} else {
|
||||
validate(!HACKY_isInviteOnlyEvent(event), "Event is invite only");
|
||||
validate(
|
||||
!tournament.teamMemberOfByUser(user),
|
||||
"You are already in a team that you aren't captain of",
|
||||
);
|
||||
|
||||
createTeam({
|
||||
name: data.teamName,
|
||||
|
||||
Reference in New Issue
Block a user