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:
Raphaël Bosi
2025-02-27 11:51:15 +01:00
committed by GitHub
parent f186b728e3
commit 05f15a827f

View File

@ -11,7 +11,10 @@ export function filterOutSelfAndContactsFromCompanyOrWorkspace(
): Contact[] {
const selfDomainName = getDomainNameFromHandle(connectedAccount.handle);
const handleAliases = connectedAccount.handleAliases?.split(',') || [];
const allHandles = [
connectedAccount.handle,
...(connectedAccount.handleAliases?.split(',') || []),
];
const workspaceMembersMap = workspaceMembers.reduce(
(map, workspaceMember) => {
@ -30,6 +33,6 @@ export function filterOutSelfAndContactsFromCompanyOrWorkspace(
(isDifferentDomain(contact, selfDomainName) ||
!isWorkDomain(selfDomainName)) &&
!workspaceMembersMap[contact.handle] &&
!handleAliases.includes(contact.handle),
!allHandles.includes(contact.handle),
);
}