feat: allow non-empty shared workspace names (#5363)

This commit is contained in:
Nivedin 2025-09-02 13:48:28 +05:30 committed by GitHub
parent aac4c5b34b
commit 5bab04a487
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 7 deletions

View file

@ -361,8 +361,8 @@ describe('renameTeam', () => {
).resolves.toEqualLeft(TEAM_INVALID_ID); ).resolves.toEqualLeft(TEAM_INVALID_ID);
}); });
test('rejects for new team name length < 6 with TEAM_NAME_INVALID', () => { test('rejects for new team name empty with TEAM_NAME_INVALID', () => {
const newTeamName = 'smol'; const newTeamName = '';
// Prisma doesn't care about the team name length, so it will resolve // Prisma doesn't care about the team name length, so it will resolve
mockPrisma.team.update.mockResolvedValue({ mockPrisma.team.update.mockResolvedValue({
@ -668,8 +668,8 @@ describe('createTeam', () => {
).resolves.toEqualRight(expect.objectContaining(team)); ).resolves.toEqualRight(expect.objectContaining(team));
}); });
test('rejects for team name length < 6 with TEAM_NAME_INVALID', () => { test('rejects for team name empty with TEAM_NAME_INVALID', () => {
const newName = 'smol'; const newName = '';
// Prisma doesn't care // Prisma doesn't care
mockPrisma.team.create.mockResolvedValue({ mockPrisma.team.create.mockResolvedValue({

View file

@ -124,7 +124,7 @@ export class TeamService implements UserDataHandler, OnModuleInit {
} }
validateTeamName(title: string): E.Left<string> | E.Right<boolean> { validateTeamName(title: string): E.Left<string> | E.Right<boolean> {
if (!title || title.length < 6) return E.left(TEAM_NAME_INVALID); if (!title || title.trim() === '') return E.left(TEAM_NAME_INVALID);
return E.right(true); return E.right(true);
} }

View file

@ -1521,7 +1521,7 @@
"member_role_updated": "User roles updated", "member_role_updated": "User roles updated",
"members": "Members", "members": "Members",
"more_members": "+{count} more", "more_members": "+{count} more",
"name_length_insufficient": "Workspace name should be at least 6 characters long", "name_length_insufficient": "Workspace name should not be empty",
"name_updated": "Workspace name updated", "name_updated": "Workspace name updated",
"new": "New Workspace", "new": "New Workspace",
"new_created": "New workspace created", "new_created": "New workspace created",

View file

@ -6,7 +6,7 @@ interface TeamNameBrand {
export const TeamNameCodec = t.brand( export const TeamNameCodec = t.brand(
t.string, t.string,
(x): x is t.Branded<string, TeamNameBrand> => x.trim().length >= 6, (x): x is t.Branded<string, TeamNameBrand> => x.trim() !== "",
"TeamName" "TeamName"
) )