diff --git a/packages/presentation/src/components/AddMembersPopup.svelte b/packages/presentation/src/components/AddMembersPopup.svelte index 87e326ff27..da90635248 100644 --- a/packages/presentation/src/components/AddMembersPopup.svelte +++ b/packages/presentation/src/components/AddMembersPopup.svelte @@ -1,19 +1,17 @@ diff --git a/plugins/chunter-resources/src/components/SavedMessages.svelte b/plugins/chunter-resources/src/components/SavedMessages.svelte index 0791b8a96e..11280780fa 100644 --- a/plugins/chunter-resources/src/components/SavedMessages.svelte +++ b/plugins/chunter-resources/src/components/SavedMessages.svelte @@ -2,7 +2,8 @@ import attachment, { Attachment } from '@hcengineering/attachment' import AttachmentPreview from '@hcengineering/attachment-resources/src/components/AttachmentPreview.svelte' import { ChunterMessage } from '@hcengineering/chunter' - import contact, { Employee, EmployeeAccount, getName as getContactName } from '@hcengineering/contact' + import contact, { EmployeeAccount, getName as getContactName } from '@hcengineering/contact' + import { employeeByIdStore } from '@hcengineering/contact-resources' import core, { IdMap, Ref, toIdMap, WithLookup } from '@hcengineering/core' import { createQuery, getClient } from '@hcengineering/presentation' import { Label, Scroller } from '@hcengineering/ui' @@ -17,17 +18,14 @@ let savedAttachmentsIds: Ref[] = [] let savedAttachments: WithLookup[] = [] let accounts: IdMap = new Map() - let employees: IdMap = new Map() const messagesQuery = createQuery() const attachmentsQuery = createQuery() const savedMessagesQuery = createQuery() const savedAttachmentsQuery = createQuery() const accQ = createQuery() - const empQ = createQuery() accQ.query(contact.class.EmployeeAccount, {}, (res) => (accounts = toIdMap(res))) - empQ.query(contact.class.Employee, {}, (res) => (employees = toIdMap(res))) savedMessagesQuery.query(chunter.class.SavedMessages, {}, (res) => { savedMessagesIds = res.map((r) => r.attachedTo) @@ -83,7 +81,7 @@ function getName (a: Attachment): string | undefined { const acc = accounts.get(a.modifiedBy as Ref) if (acc !== undefined) { - const emp = employees.get(acc?.employee) + const emp = $employeeByIdStore.get(acc?.employee) if (emp !== undefined) { return getContactName(emp) } diff --git a/plugins/chunter-resources/src/components/Thread.svelte b/plugins/chunter-resources/src/components/Thread.svelte index de9c13b15c..57a52668b0 100644 --- a/plugins/chunter-resources/src/components/Thread.svelte +++ b/plugins/chunter-resources/src/components/Thread.svelte @@ -17,6 +17,7 @@ import { AttachmentRefInput } from '@hcengineering/attachment-resources' import type { ChunterSpace, Message, ThreadMessage } from '@hcengineering/chunter' import contact, { Employee, EmployeeAccount, getName } from '@hcengineering/contact' + import { employeeByIdStore } from '@hcengineering/contact-resources' import core, { FindOptions, generateId, @@ -24,7 +25,6 @@ IdMap, Ref, SortingOrder, - toIdMap, TxFactory } from '@hcengineering/core' import { NotificationClientImpl } from '@hcengineering/notification-resources' @@ -102,11 +102,6 @@ ) } - let employees: IdMap = new Map() - const employeeQuery = createQuery() - - employeeQuery.query(contact.class.Employee, {}, (res) => (employees = toIdMap(res))) - async function getParticipants ( comments: ThreadMessage[], parent: Message | undefined, @@ -176,7 +171,7 @@ {/if} {/await} - {#await getParticipants(comments, parent, employees) then participants} + {#await getParticipants(comments, parent, $employeeByIdStore) then participants} {participants.join(', ')}