From e44221ef11ec273e328758b59508bf533301b1d0 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 20 Jul 2022 18:38:52 +0100 Subject: [PATCH] fix: Cannot create new team on self-hosted --- server/commands/teamCreator.test.ts | 17 +++++++++++++++++ server/commands/teamCreator.ts | 4 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/server/commands/teamCreator.test.ts b/server/commands/teamCreator.test.ts index e57f717489..a6aba15f2a 100644 --- a/server/commands/teamCreator.test.ts +++ b/server/commands/teamCreator.test.ts @@ -73,6 +73,23 @@ describe("teamCreator", () => { }); describe("self hosted", () => { + it("should allow creating first team", async () => { + env.DEPLOYMENT = undefined; + const { team, isNewTeam } = await teamCreator({ + name: "Test team", + subdomain: "example", + avatarUrl: "http://example.com/logo.png", + authenticationProvider: { + name: "google", + providerId: "example.com", + }, + ip, + }); + + expect(isNewTeam).toBeTruthy(); + expect(team.name).toEqual("Test team"); + }); + it("should not allow creating multiple teams in installation", async () => { env.DEPLOYMENT = undefined; await buildTeam(); diff --git a/server/commands/teamCreator.ts b/server/commands/teamCreator.ts index 2c175ef1e6..ee4c8448c4 100644 --- a/server/commands/teamCreator.ts +++ b/server/commands/teamCreator.ts @@ -78,7 +78,9 @@ async function teamCreator({ } } - throw MaximumTeamsError(); + if (team) { + throw MaximumTeamsError(); + } } // If the service did not provide a logo/avatar then we attempt to generate