fix(trading): validate whitespace team names, show empty in list (#5727)
Co-authored-by: Madalina Raicu <madalina@raygroup.uk>
This commit is contained in:
parent
0d850bd8b9
commit
c7dd5e846a
@ -46,7 +46,7 @@ const prepareTransaction = (
|
||||
createReferralSet: {
|
||||
isTeam: true,
|
||||
team: {
|
||||
name: fields.name,
|
||||
name: fields.name.trim(),
|
||||
teamUrl: fields.url,
|
||||
avatarUrl: fields.avatarUrl,
|
||||
closed: fields.private,
|
||||
@ -62,7 +62,7 @@ const prepareTransaction = (
|
||||
id: fields.id,
|
||||
isTeam: true,
|
||||
team: {
|
||||
name: fields.name,
|
||||
name: fields.name.trim(),
|
||||
teamUrl: fields.url,
|
||||
avatarUrl: fields.avatarUrl,
|
||||
closed: fields.private,
|
||||
@ -116,7 +116,17 @@ export const TeamForm = ({
|
||||
<input type="hidden" {...register('id')} />
|
||||
<TradingFormGroup label={t('Team name')} labelFor="name">
|
||||
<TradingInput
|
||||
{...register('name', { required: t('Required') })}
|
||||
{...register('name', {
|
||||
required: t('Required'),
|
||||
validate: {
|
||||
notEmpty: (value) => {
|
||||
if (/^\s*$/.test(value)) {
|
||||
return t('Team name cannot be empty');
|
||||
}
|
||||
return true;
|
||||
},
|
||||
},
|
||||
})}
|
||||
data-testid="team-name-input"
|
||||
/>
|
||||
{errors.name?.message && (
|
||||
|
@ -56,7 +56,10 @@ export const CompetitionsLeaderboard = ({
|
||||
className="hover:underline"
|
||||
to={Links.COMPETITIONS_TEAM(td.teamId)}
|
||||
>
|
||||
{td.name}
|
||||
{
|
||||
// Its possible for a tx to be submitted with an empty space as team name
|
||||
td.name.trim() !== '' ? td.name : t('[empty]')
|
||||
}
|
||||
</Link>
|
||||
),
|
||||
earned: num(td.totalQuantumRewards),
|
||||
|
@ -90,6 +90,7 @@
|
||||
"Earned by me": "Earned by me",
|
||||
"Eligible teams": "Eligible teams",
|
||||
"Enactment date reached and usual auction exit checks pass": "Enactment date reached and usual auction exit checks pass",
|
||||
"[empty]": "[empty]",
|
||||
"Ends in": "Ends in",
|
||||
"Entity scope": "Entity scope",
|
||||
"{{entity}} scope": "{{entity}} scope",
|
||||
@ -317,6 +318,7 @@
|
||||
"Target stake": "Target stake",
|
||||
"Team": "Team",
|
||||
"Team name": "Team name",
|
||||
"Team name cannot be empty": "Team name cannot be empty",
|
||||
"Team creation transaction successful": "Team creation transaction successful",
|
||||
"Team joined": "Team joined",
|
||||
"Team switch successful. You will switch team at the end of the epoch.": "Team switch successful. You will switch team at the end of the epoch.",
|
||||
|
Loading…
Reference in New Issue
Block a user