Fix domain name parsing on company creation (#4297)
* add domain parsing library * change package for psl * trying to fix error * fix * update * remove unused function
This commit is contained in:
@ -28,7 +28,7 @@ export class CreateCompaniesAndContactsService {
|
||||
workspaceId: string,
|
||||
transactionManager?: EntityManager,
|
||||
) {
|
||||
if (participants.length === 0) {
|
||||
if (!participants || participants.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -51,6 +51,10 @@ export class CreateCompaniesAndContactsService {
|
||||
const { uniqueParticipants, uniqueHandles } =
|
||||
getUniqueParticipantsAndHandles(participantsFromOtherCompanies);
|
||||
|
||||
if (uniqueHandles.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const alreadyCreatedContacts = await this.personService.getByEmails(
|
||||
uniqueHandles,
|
||||
workspaceId,
|
||||
|
||||
@ -23,6 +23,10 @@ export class CreateCompanyService {
|
||||
): Promise<{
|
||||
[domainName: string]: string;
|
||||
}> {
|
||||
if (domainNames.length === 0) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const uniqueDomainNames = [...new Set(domainNames)];
|
||||
|
||||
const existingCompanies =
|
||||
|
||||
Reference in New Issue
Block a user