Fix contact creation (#10540)
Fixes the following bug: When I connect an account, a contact is created for that email if the domain name differs from the workspace domain name.
This commit is contained in:
@ -11,7 +11,10 @@ export function filterOutSelfAndContactsFromCompanyOrWorkspace(
|
|||||||
): Contact[] {
|
): Contact[] {
|
||||||
const selfDomainName = getDomainNameFromHandle(connectedAccount.handle);
|
const selfDomainName = getDomainNameFromHandle(connectedAccount.handle);
|
||||||
|
|
||||||
const handleAliases = connectedAccount.handleAliases?.split(',') || [];
|
const allHandles = [
|
||||||
|
connectedAccount.handle,
|
||||||
|
...(connectedAccount.handleAliases?.split(',') || []),
|
||||||
|
];
|
||||||
|
|
||||||
const workspaceMembersMap = workspaceMembers.reduce(
|
const workspaceMembersMap = workspaceMembers.reduce(
|
||||||
(map, workspaceMember) => {
|
(map, workspaceMember) => {
|
||||||
@ -30,6 +33,6 @@ export function filterOutSelfAndContactsFromCompanyOrWorkspace(
|
|||||||
(isDifferentDomain(contact, selfDomainName) ||
|
(isDifferentDomain(contact, selfDomainName) ||
|
||||||
!isWorkDomain(selfDomainName)) &&
|
!isWorkDomain(selfDomainName)) &&
|
||||||
!workspaceMembersMap[contact.handle] &&
|
!workspaceMembersMap[contact.handle] &&
|
||||||
!handleAliases.includes(contact.handle),
|
!allHandles.includes(contact.handle),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user