From e005c60ea6118ec755916fec77a6dddb3853e6fd Mon Sep 17 00:00:00 2001 From: Kristina Date: Fri, 25 Jul 2025 20:15:52 +0400 Subject: [PATCH] Fix cannot find social id error for system (#9603) Signed-off-by: Kristina Fefelova --- server-plugins/contact/src/utils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server-plugins/contact/src/utils.ts b/server-plugins/contact/src/utils.ts index e82c37baeb..eaa76b8c92 100644 --- a/server-plugins/contact/src/utils.ts +++ b/server-plugins/contact/src/utils.ts @@ -15,7 +15,7 @@ import { TriggerControl } from '@hcengineering/server-core' import contact, { Employee, type Person, PersonSpace, SocialIdentityRef } from '@hcengineering/contact' -import { AccountUuid, parseSocialIdString, PersonId, type Ref, SocialId, toIdMap } from '@hcengineering/core' +import core, { AccountUuid, parseSocialIdString, PersonId, type Ref, SocialId, toIdMap } from '@hcengineering/core' export async function getCurrentPerson (control: TriggerControl): Promise { const { type, value } = parseSocialIdString(control.txFactory.account) @@ -81,6 +81,8 @@ export async function getAllSocialStringsByPersonId ( } export async function getPerson (control: TriggerControl, personId: PersonId): Promise { + if (personId === core.account.System) return undefined + const { contextData } = control.ctx const account: AccountUuid | undefined = contextData.account.socialIds.includes(personId) ? contextData.account.uuid @@ -103,6 +105,8 @@ export async function getPerson (control: TriggerControl, personId: PersonId): P } export async function getEmployee (control: TriggerControl, personId: PersonId): Promise { + if (personId === core.account.System) return undefined + const socialId = ( await control.findAll(control.ctx, contact.class.SocialIdentity, { _id: personId as SocialIdentityRef }) )[0]