Skip to content

Commit e005c60

Browse files
Fix cannot find social id error for system (#9603)
Signed-off-by: Kristina Fefelova <[email protected]>
1 parent 72c3aae commit e005c60

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server-plugins/contact/src/utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import { TriggerControl } from '@hcengineering/server-core'
1717
import contact, { Employee, type Person, PersonSpace, SocialIdentityRef } from '@hcengineering/contact'
18-
import { AccountUuid, parseSocialIdString, PersonId, type Ref, SocialId, toIdMap } from '@hcengineering/core'
18+
import core, { AccountUuid, parseSocialIdString, PersonId, type Ref, SocialId, toIdMap } from '@hcengineering/core'
1919

2020
export async function getCurrentPerson (control: TriggerControl): Promise<Person | undefined> {
2121
const { type, value } = parseSocialIdString(control.txFactory.account)
@@ -81,6 +81,8 @@ export async function getAllSocialStringsByPersonId (
8181
}
8282

8383
export async function getPerson (control: TriggerControl, personId: PersonId): Promise<Person | undefined> {
84+
if (personId === core.account.System) return undefined
85+
8486
const { contextData } = control.ctx
8587
const account: AccountUuid | undefined = contextData.account.socialIds.includes(personId)
8688
? contextData.account.uuid
@@ -103,6 +105,8 @@ export async function getPerson (control: TriggerControl, personId: PersonId): P
103105
}
104106

105107
export async function getEmployee (control: TriggerControl, personId: PersonId): Promise<Employee | undefined> {
108+
if (personId === core.account.System) return undefined
109+
106110
const socialId = (
107111
await control.findAll(control.ctx, contact.class.SocialIdentity, { _id: personId as SocialIdentityRef })
108112
)[0]

0 commit comments

Comments
 (0)