mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-24 12:34:10 +03:00
Remove shouldUseEmailsField (#7208)
Remove shouldUseEmailsField. This boolean was used to ensure retro-compatibility with the old email field. It is no longer needed.
This commit is contained in:
parent
8385d3cfdf
commit
4d31995564
@ -143,11 +143,8 @@ export class CreateCompanyAndContactService {
|
|||||||
createdByWorkspaceMember: connectedAccount.accountOwner,
|
createdByWorkspaceMember: connectedAccount.accountOwner,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const shouldUseEmailsField = isDefined(emailsFieldMetadata);
|
|
||||||
|
|
||||||
return this.createContactService.createPeople(
|
return this.createContactService.createPeople(
|
||||||
formattedContactsToCreate,
|
formattedContactsToCreate,
|
||||||
shouldUseEmailsField,
|
|
||||||
workspaceId,
|
workspaceId,
|
||||||
transactionManager,
|
transactionManager,
|
||||||
);
|
);
|
||||||
|
@ -28,7 +28,6 @@ export class CreateContactService {
|
|||||||
private formatContacts(
|
private formatContacts(
|
||||||
contactsToCreate: ContactToCreate[],
|
contactsToCreate: ContactToCreate[],
|
||||||
lastPersonPosition: number,
|
lastPersonPosition: number,
|
||||||
shouldUseEmailsField: boolean,
|
|
||||||
): DeepPartial<PersonWorkspaceEntity>[] {
|
): DeepPartial<PersonWorkspaceEntity>[] {
|
||||||
return contactsToCreate.map((contact) => {
|
return contactsToCreate.map((contact) => {
|
||||||
const id = v4();
|
const id = v4();
|
||||||
@ -47,9 +46,7 @@ export class CreateContactService {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
...(shouldUseEmailsField
|
emails: { primaryEmail: handle, additionalEmails: null },
|
||||||
? { emails: { primaryEmail: handle, additionalEmails: null } }
|
|
||||||
: { email: handle }),
|
|
||||||
name: {
|
name: {
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
@ -67,7 +64,6 @@ export class CreateContactService {
|
|||||||
|
|
||||||
public async createPeople(
|
public async createPeople(
|
||||||
contactsToCreate: ContactToCreate[],
|
contactsToCreate: ContactToCreate[],
|
||||||
shouldUseEmailsField: boolean,
|
|
||||||
workspaceId: string,
|
workspaceId: string,
|
||||||
transactionManager?: EntityManager,
|
transactionManager?: EntityManager,
|
||||||
): Promise<DeepPartial<PersonWorkspaceEntity>[]> {
|
): Promise<DeepPartial<PersonWorkspaceEntity>[]> {
|
||||||
@ -87,7 +83,6 @@ export class CreateContactService {
|
|||||||
const formattedContacts = this.formatContacts(
|
const formattedContacts = this.formatContacts(
|
||||||
contactsToCreate,
|
contactsToCreate,
|
||||||
lastPersonPosition,
|
lastPersonPosition,
|
||||||
shouldUseEmailsField,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return personRepository.save(
|
return personRepository.save(
|
||||||
|
Loading…
Reference in New Issue
Block a user