refactor(auth): optimize work email handling in sign-up flow (#11655)

Extracted isWorkEmail check into a variable for reusability and adjusted
subdomain generation to conditionally include email. This enhances code
readability and maintains logic consistency.
This commit is contained in:
Antoine Moreaux
2025-04-19 15:28:41 +02:00
committed by GitHub
parent 826889715b
commit 83434deb22

View File

@ -352,11 +352,14 @@ export class SignInUpService {
}
};
const isWorkEmailFound = isWorkEmail(email);
const logo =
isWorkEmail(email) && (await isLogoUrlValid()) ? logoUrl : undefined;
isWorkEmailFound && (await isLogoUrlValid()) ? logoUrl : undefined;
const workspaceToCreate = this.workspaceRepository.create({
subdomain: await this.domainManagerService.generateSubdomain(),
subdomain: await this.domainManagerService.generateSubdomain(
isWorkEmailFound ? { email } : {},
),
displayName: '',
inviteHash: v4(),
activationStatus: WorkspaceActivationStatus.PENDING_CREATION,