diff --git a/packages/twenty-front/src/modules/auth/components/Logo.tsx b/packages/twenty-front/src/modules/auth/components/Logo.tsx index 24b2acab5..482be37ac 100644 --- a/packages/twenty-front/src/modules/auth/components/Logo.tsx +++ b/packages/twenty-front/src/modules/auth/components/Logo.tsx @@ -5,7 +5,7 @@ import { Avatar } from 'twenty-ui/display'; import { UndecoratedLink } from 'twenty-ui/navigation'; import { REACT_APP_SERVER_BASE_URL } from '~/config'; import { useRedirectToDefaultDomain } from '~/modules/domain-manager/hooks/useRedirectToDefaultDomain'; -import { useReadDefaultDomainFromConfiguration } from '@/domain-manager/hooks/useReadDefaultDomainFromConfiguration'; +import { useReadDefaultDomainFromConfiguration } from '~/modules/domain-manager/hooks/useReadDefaultDomainFromConfiguration'; type LogoProps = { primaryLogo?: string | null; diff --git a/packages/twenty-server/src/engine/core-modules/domain-manager/services/domain-manager.service.ts b/packages/twenty-server/src/engine/core-modules/domain-manager/services/domain-manager.service.ts index f13fc186b..870ef4fe6 100644 --- a/packages/twenty-server/src/engine/core-modules/domain-manager/services/domain-manager.service.ts +++ b/packages/twenty-server/src/engine/core-modules/domain-manager/services/domain-manager.service.ts @@ -112,14 +112,6 @@ export class DomainManagerService { }; }; - async getWorkspaceBySubdomainOrDefaultWorkspace(subdomain?: string) { - return subdomain - ? await this.workspaceRepository.findOne({ - where: { subdomain }, - }) - : await this.getDefaultWorkspace(); - } - isDefaultSubdomain(subdomain: string) { return subdomain === this.twentyConfigService.get('DEFAULT_SUBDOMAIN'); } diff --git a/packages/twenty-server/src/engine/core-modules/user-workspace/user-workspace.service.ts b/packages/twenty-server/src/engine/core-modules/user-workspace/user-workspace.service.ts index b93b80c6c..052644093 100644 --- a/packages/twenty-server/src/engine/core-modules/user-workspace/user-workspace.service.ts +++ b/packages/twenty-server/src/engine/core-modules/user-workspace/user-workspace.service.ts @@ -282,11 +282,11 @@ export class UserWorkspaceService extends TypeOrmQueryService { await this.workspaceInvitationService.findInvitationsByEmail(email) ) .filter( - ({ workspaceId }) => + ({ workspace }) => ![ ...alreadyMemberWorkspacesIds, ...workspacesFromApprovedAccessDomainIds, - ].includes(workspaceId), + ].includes(workspace.id), ) .map((appToken) => ({ workspace: appToken.workspace, diff --git a/packages/twenty-server/src/engine/core-modules/workspace-invitation/services/workspace-invitation.service.ts b/packages/twenty-server/src/engine/core-modules/workspace-invitation/services/workspace-invitation.service.ts index e3318c907..d0c8f7c84 100644 --- a/packages/twenty-server/src/engine/core-modules/workspace-invitation/services/workspace-invitation.service.ts +++ b/packages/twenty-server/src/engine/core-modules/workspace-invitation/services/workspace-invitation.service.ts @@ -85,26 +85,10 @@ export class WorkspaceInvitationService { } } - async findInvitationByWorkspaceSubdomainAndUserEmail({ - subdomain, - email, - }: { - subdomain: string; - email: string; - }) { - const workspace = - await this.domainManagerService.getWorkspaceBySubdomainOrDefaultWorkspace( - subdomain, - ); - - if (!workspace) return; - - return await this.getOneWorkspaceInvitation(workspace.id, email); - } - async findInvitationsByEmail(email: string) { return await this.appTokenRepository .createQueryBuilder('appToken') + .innerJoinAndSelect('appToken.workspace', 'workspace') .where('"appToken".type = :type', { type: AppTokenType.InvitationToken, }) @@ -113,7 +97,6 @@ export class WorkspaceInvitationService { .andWhere('appToken.expiresAt > :now', { now: new Date(), }) - .leftJoinAndSelect('appToken.workspace', 'workspace') .getMany(); }