diff --git a/server-plugins/notification-resources/src/index.ts b/server-plugins/notification-resources/src/index.ts index 0db66810e4..f21c385daa 100644 --- a/server-plugins/notification-resources/src/index.ts +++ b/server-plugins/notification-resources/src/index.ts @@ -279,7 +279,7 @@ async function getValueCollaborators (value: any, attr: AnyAttribute, control: T const hierarchy = control.hierarchy if (attr.type._class === core.class.RefTo) { const to = (attr.type as RefTo).to - if (hierarchy.isDerived(to, contact.mixin.Employee)) { + if (hierarchy.isDerived(to, contact.class.Person)) { const acc = await getPersonAccount(value, control) return acc !== undefined ? [acc._id] : [] } else if (hierarchy.isDerived(to, core.class.Account)) { @@ -290,7 +290,7 @@ async function getValueCollaborators (value: any, attr: AnyAttribute, control: T const arrOf = (attr.type as ArrOf>).of if (arrOf._class === core.class.RefTo) { const to = (arrOf as RefTo).to - if (hierarchy.isDerived(to, contact.mixin.Employee)) { + if (hierarchy.isDerived(to, contact.class.Person)) { const employeeAccounts = await control.modelDb.findAll(contact.class.PersonAccount, { person: { $in: Array.isArray(value) ? value : [value] } }) diff --git a/server-plugins/notification/src/index.ts b/server-plugins/notification/src/index.ts index b7359757cc..b1062965ff 100644 --- a/server-plugins/notification/src/index.ts +++ b/server-plugins/notification/src/index.ts @@ -1,6 +1,6 @@ // // Copyright © 2020, 2021 Anticrm Platform Contributors. -// Copyright © 2021, 2022 Hardcore Engineering Inc. +// Copyright © 2021, 2022, 2023 Hardcore Engineering Inc. // // Licensed under the Eclipse Public License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. You may @@ -14,7 +14,7 @@ // limitations under the License. // -import contact, { Employee, PersonAccount } from '@hcengineering/contact' +import contact, { Employee, Person, PersonAccount } from '@hcengineering/contact' import { Account, Class, Doc, Mixin, Ref, Tx } from '@hcengineering/core' import { NotificationType } from '@hcengineering/notification' import { Plugin, Resource, plugin } from '@hcengineering/platform' @@ -29,14 +29,14 @@ export const serverNotificationId = 'server-notification' as Plugin * @public */ export async function getPersonAccount ( - employee: Ref, + person: Ref, control: TriggerControl ): Promise { const account = ( await control.modelDb.findAll( contact.class.PersonAccount, { - employee + person }, { limit: 1 } )