Couple tournament admin registration form fixes
Some checks are pending
E2E Tests / e2e (push) Waiting to run
Tests and checks on push / run-checks-and-tests (push) Waiting to run
Updates translation progress / update-translation-progress-issue (push) Waiting to run

This commit is contained in:
Kalle
2026-06-17 21:37:17 +03:00
parent c7ba494b2b
commit 32dabbb796
3 changed files with 16 additions and 5 deletions

View File

@@ -72,7 +72,9 @@ export default function TournamentAdminRegistrationPage() {
ownerId: owner ? String(owner.userId) : "",
members: team.members.map((member) => ({
userId: member.userId,
inGameName: member.inGameName ?? null,
inGameName: tournament.ctx.settings.requireInGameNames
? (member.inGameName ?? null)
: null,
})),
}
: undefined;

View File

@@ -3,8 +3,12 @@ import { userIsBanned } from "~/features/ban/core/banned.server";
import * as TeamRepository from "~/features/team/TeamRepository.server";
import { tournamentTeamNameTaken } from "~/features/tournament/tournament-utils.server";
import type { Tournament } from "~/features/tournament-bracket/core/Tournament";
import { inGameNameIsValid } from "~/features/user-page/in-game-name";
import * as UserRepository from "~/features/user-page/UserRepository.server";
import { adminRegistrationFormSchema } from "./tournament-admin-registration-schemas";
import {
ADMIN_REGISTRATION_MAX_MEMBERS,
adminRegistrationFormSchema,
} from "./tournament-admin-registration-schemas";
/**
* Extends the client {@link adminRegistrationFormSchema} with server-only,
@@ -38,7 +42,7 @@ export function adminRegistrationFormSchemaServer({
});
}
if (data.members.length > tournament.maxMembersPerTeam) {
if (data.members.length > ADMIN_REGISTRATION_MAX_MEMBERS) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "forms:errors.regTooManyMembers",

View File

@@ -14,7 +14,12 @@ import {
tournamentSearchOptional,
userSearch,
} from "~/form/fields";
import { TEAM } from "../team/team-constants";
/**
* Roster size cap for organizer-managed registrations. The per-tournament
* `maxMembersPerTeam` limit intentionally doesn't apply to organizers, so this
* is just a generous safety ceiling rather than a competitive constraint.
*/
export const ADMIN_REGISTRATION_MAX_MEMBERS = 20;
const memberFieldset = fieldset({
fields: z.object({
@@ -44,7 +49,7 @@ export const adminRegistrationFormSchema = z
members: array({
label: "labels.members",
min: 1,
max: TEAM.MAX_MEMBER_COUNT,
max: ADMIN_REGISTRATION_MAX_MEMBERS,
field: memberFieldset,
}),
})