diff --git a/desktop/src/ui/notifications.ts b/desktop/src/ui/notifications.ts index c5d9577799..4e2e034732 100644 --- a/desktop/src/ui/notifications.ts +++ b/desktop/src/ui/notifications.ts @@ -1,4 +1,4 @@ -import { getPersonBySocialId, formatName } from '@hcengineering/contact' +import { getPersonByPersonId, formatName } from '@hcengineering/contact' import { Ref, TxOperations } from '@hcengineering/core' import notification, { DocNotifyContext, CommonInboxNotification, ActivityInboxNotification, InboxNotification } from '@hcengineering/notification' import { IntlString, addEventListener, translate } from '@hcengineering/platform' @@ -67,7 +67,7 @@ async function hydrateNotificationAsYouCan (lastNotification: InboxNotification) body: '' } - const person = await getPersonBySocialId(client, lastNotification.modifiedBy) + const person = await getPersonByPersonId(client, lastNotification.modifiedBy) if (person == null) { return noPersonData } diff --git a/desktop/tsconfig.json b/desktop/tsconfig.json index 3eb6964bf7..d0b34862c1 100644 --- a/desktop/tsconfig.json +++ b/desktop/tsconfig.json @@ -11,7 +11,7 @@ "skipLibCheck": true, "moduleResolution": "node", "allowSyntheticDefaultImports": true, - "lib": ["es2016", "dom", "ES2021.String", "ESNext.Array"] + "lib": ["es2023", "dom", "ES2021.String", "ESNext.Array"] }, "include": ["src/**/*", "declarations.d.ts"], "exclude": ["node_modules", "lib", "dist", "types", "bundle"] diff --git a/dev/prod/tsconfig.json b/dev/prod/tsconfig.json index 6f5772afd8..88ea8fe1cc 100644 --- a/dev/prod/tsconfig.json +++ b/dev/prod/tsconfig.json @@ -13,7 +13,7 @@ "verbatimModuleSyntax": true, "allowSyntheticDefaultImports": true, "lib": [ - "es2016", + "es2023", "dom", "ES2021.String", "ESNext.Array" diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts index e7c6fcc9cd..e72630e067 100644 --- a/models/contact/src/index.ts +++ b/models/contact/src/index.ts @@ -826,10 +826,6 @@ export function createModel (builder: Builder): void { presenter: contact.component.PersonPresenter }) - builder.mixin(core.class.TypePersonId, core.class.Class, view.mixin.ArrayEditor, { - inlineEditor: contact.component.PersonIdArrayEditor - }) - builder.mixin(core.class.TypeAccountUuid, core.class.Class, view.mixin.ArrayEditor, { inlineEditor: contact.component.AccountArrayEditor }) diff --git a/packages/core/src/common.ts b/packages/core/src/common.ts index 34e425d5b2..fc4ee3158f 100644 --- a/packages/core/src/common.ts +++ b/packages/core/src/common.ts @@ -14,6 +14,22 @@ export function groupByArray (array: T[], keyProvider: (item: T) => K): Ma return result } +export async function groupByArrayAsync (array: T[], keyProvider: (item: T) => Promise): Promise> { + const result = new Map() + + for (const item of array) { + const key = await keyProvider(item) + + if (!result.has(key)) { + result.set(key, [item]) + } else { + result.get(key)?.push(item) + } + } + + return result +} + export function flipSet (set: Set, item: T): Set { if (set.has(item)) { set.delete(item) diff --git a/packages/core/src/utils.ts b/packages/core/src/utils.ts index 9b6219b460..fb7bf05df2 100644 --- a/packages/core/src/utils.ts +++ b/packages/core/src/utils.ts @@ -944,6 +944,14 @@ export function notEmpty (id: T | undefined | null): id is T { return id !== undefined && id !== null && id !== '' } +export function unique (arr: T[]): T[] { + return Array.from(new Set(arr)) +} + +export function uniqueNotEmpty> (arr: Array): T[] { + return unique(arr).filter(notEmpty) +} + /** * Return a current performance timestamp */ diff --git a/plugins/activity-resources/src/activityMessagesUtils.ts b/plugins/activity-resources/src/activityMessagesUtils.ts index 128e0f363a..499558ccee 100644 --- a/plugins/activity-resources/src/activityMessagesUtils.ts +++ b/plugins/activity-resources/src/activityMessagesUtils.ts @@ -19,7 +19,7 @@ import core, { type Client, type Collection, type Doc, - groupByArray, + groupByArrayAsync, type Hierarchy, type Mixin, type Ref, @@ -37,8 +37,7 @@ import { import contact, { type Person } from '@hcengineering/contact' import { type IntlString } from '@hcengineering/platform' import { type AnyComponent } from '@hcengineering/ui' -import { get } from 'svelte/store' -import { personRefByPersonIdStore } from '@hcengineering/contact-resources' +import { getPersonRefByPersonId } from '@hcengineering/contact-resources' import activity, { type ActivityMessage, type DisplayActivityMessage, @@ -257,7 +256,10 @@ export async function combineActivityMessages ( const result: Array = [...uncombined] - const groupedByType: Map = groupByArray(docUpdateMessages, getDocUpdateMessageKey) + const groupedByType: Map = await groupByArrayAsync( + docUpdateMessages, + getDocUpdateMessageKey + ) for (const [, groupedMessages] of groupedByType) { const cantMerge = groupedMessages.filter( @@ -365,8 +367,8 @@ function groupByTime (messages: T[]): T[][] { return result } -function getDocUpdateMessageKey (message: DocUpdateMessage): string { - const personRef = get(personRefByPersonIdStore).get(message.createdBy as any) +async function getDocUpdateMessageKey (message: DocUpdateMessage): Promise { + const personRef = await getPersonRefByPersonId(message.createdBy as any) if (message.action === 'update') { return [message._class, message.attachedTo, message.action, personRef, getAttributeUpdatesKey(message)].join('_') diff --git a/plugins/activity-resources/src/components/BasePreview.svelte b/plugins/activity-resources/src/components/BasePreview.svelte index e07da4709f..13b0173664 100644 --- a/plugins/activity-resources/src/components/BasePreview.svelte +++ b/plugins/activity-resources/src/components/BasePreview.svelte @@ -16,8 +16,8 @@
diff --git a/plugins/ai-bot-resources/src/utils.ts b/plugins/ai-bot-resources/src/utils.ts index 2f60f5e838..731d71b7b4 100644 --- a/plugins/ai-bot-resources/src/utils.ts +++ b/plugins/ai-bot-resources/src/utils.ts @@ -12,22 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. // -import { derived, writable } from 'svelte/store' +import { writable } from 'svelte/store' import contact, { type SocialIdentity } from '@hcengineering/contact' -import { personRefByPersonIdStore } from '@hcengineering/contact-resources' import { createQuery, onClient } from '@hcengineering/presentation' import { aiBotEmailSocialKey } from '@hcengineering/ai-bot' export const aiBotSocialIdentityStore = writable() const identityQuery = createQuery(true) -export const aiBotPersonRefStore = derived( - [personRefByPersonIdStore, aiBotSocialIdentityStore], - ([personRefByPersonId, aiBotSocialIdentity]) => { - return personRefByPersonId.get(aiBotSocialIdentity?._id) - } -) - onClient(() => { identityQuery.query(contact.class.SocialIdentity, { key: aiBotEmailSocialKey }, (res) => { aiBotSocialIdentityStore.set(res[0]) diff --git a/plugins/calendar-resources/src/components/AddParticipant.svelte b/plugins/calendar-resources/src/components/AddParticipant.svelte index 812de36c70..d2ba939481 100644 --- a/plugins/calendar-resources/src/components/AddParticipant.svelte +++ b/plugins/calendar-resources/src/components/AddParticipant.svelte @@ -14,7 +14,7 @@ -->
diff --git a/plugins/chunter-resources/src/components/ChannelTypingInfo.svelte b/plugins/chunter-resources/src/components/ChannelTypingInfo.svelte index 700c88c6e0..5244360d8f 100644 --- a/plugins/chunter-resources/src/components/ChannelTypingInfo.svelte +++ b/plugins/chunter-resources/src/components/ChannelTypingInfo.svelte @@ -15,9 +15,8 @@ diff --git a/plugins/chunter-resources/src/components/chat-message/ChatMessagePresenter.svelte b/plugins/chunter-resources/src/components/chat-message/ChatMessagePresenter.svelte index 5ba103df7d..70db49fca9 100644 --- a/plugins/chunter-resources/src/components/chat-message/ChatMessagePresenter.svelte +++ b/plugins/chunter-resources/src/components/chat-message/ChatMessagePresenter.svelte @@ -18,12 +18,8 @@ import { Attachment } from '@hcengineering/attachment' import { AttachmentDocList, AttachmentImageSize } from '@hcengineering/attachment-resources' import chunter, { ChatMessage, ChatMessageViewlet } from '@hcengineering/chunter' - import contact, { getCurrentEmployee, type SocialIdentityRef } from '@hcengineering/contact' - import { - personByPersonIdStore, - primarySocialIdByPersonIdStore, - socialIdsStore - } from '@hcengineering/contact-resources' + import contact, { getCurrentEmployee, Person, SocialIdentity } from '@hcengineering/contact' + import { getPersonByPersonIdCb, getSocialIdByPersonIdCb } from '@hcengineering/contact-resources' import { Class, Doc, Markup, Ref, Space, WithLookup } from '@hcengineering/core' import { getClient, MessageViewer, pendingCreatedDocs } from '@hcengineering/presentation' import { EmptyMarkup } from '@hcengineering/text' @@ -80,9 +76,19 @@ : [] $: personId = value?.createdBy - $: person = personId !== undefined ? $personByPersonIdStore.get(personId) : undefined - - $: socialId = personId !== undefined ? $socialIdsStore.get(personId as SocialIdentityRef) : undefined + let person: Person | undefined + let socialId: SocialIdentity | undefined + $: if (personId !== undefined) { + getPersonByPersonIdCb(personId, (p) => { + person = p ?? undefined + }) + getSocialIdByPersonIdCb(personId, (s) => { + socialId = s ?? undefined + }) + } else { + person = undefined + socialId = undefined + } let originalText = value?.message diff --git a/plugins/chunter-resources/src/components/chat/ChannelAside.svelte b/plugins/chunter-resources/src/components/chat/ChannelAside.svelte index f82458dfc2..39f925a442 100644 --- a/plugins/chunter-resources/src/components/chat/ChannelAside.svelte +++ b/plugins/chunter-resources/src/components/chat/ChannelAside.svelte @@ -21,10 +21,10 @@ import { Employee, Person } from '@hcengineering/contact' import { EmployeeBox, - personRefByPersonIdStore, - personRefByAccountUuidStore, + employeeRefByAccountUuidStore, SelectUsersPopup, - employeeByIdStore + employeeByIdStore, + getPersonRefByPersonIdCb } from '@hcengineering/contact-resources' import ChannelMembers from '../ChannelMembers.svelte' @@ -38,7 +38,13 @@ let members = new Set>() - $: creatorPersonRef = object.createdBy !== undefined ? $personRefByPersonIdStore.get(object.createdBy) : undefined + let creatorPersonRef: Ref + $: if (object.createdBy !== undefined) { + getPersonRefByPersonIdCb(object.createdBy, (personRef) => { + if (personRef == null) return + creatorPersonRef = personRef + }) + } $: disabledRemoveFor = object.createdBy !== undefined && !socialStrings.includes(object.createdBy) && creatorPersonRef !== undefined @@ -52,7 +58,7 @@ return } - members = new Set(object.members.map((account) => $personRefByAccountUuidStore.get(account)).filter(notEmpty)) + members = new Set(object.members.map((account) => $employeeRefByAccountUuidStore.get(account)).filter(notEmpty)) } function getAccountsByPersons (persons: Ref[]): AccountUuid[] { diff --git a/plugins/chunter-resources/src/components/chat/specials/SavedMessages.svelte b/plugins/chunter-resources/src/components/chat/specials/SavedMessages.svelte index ac7d0922c2..72f3fd9dbd 100644 --- a/plugins/chunter-resources/src/components/chat/specials/SavedMessages.svelte +++ b/plugins/chunter-resources/src/components/chat/specials/SavedMessages.svelte @@ -15,9 +15,9 @@
diff --git a/plugins/communication-resources/src/components/TypingPresenter.svelte b/plugins/communication-resources/src/components/TypingPresenter.svelte index 80a062cb6c..66331dfce1 100644 --- a/plugins/communication-resources/src/components/TypingPresenter.svelte +++ b/plugins/communication-resources/src/components/TypingPresenter.svelte @@ -12,9 +12,9 @@ @@ -53,7 +55,7 @@ {#if membersToAdd.length}
{#each membersToAdd as m} - {@const employee = $personByIdStore.get(m)} + {@const employee = $employeeByIdStore.get(m)}
{employee !== undefined ? getName(client.getHierarchy(), employee) : ''}
@@ -86,10 +88,7 @@
{/each} diff --git a/plugins/love-resources/src/components/RoomConfigure.svelte b/plugins/love-resources/src/components/RoomConfigure.svelte index e6a7e7dd1f..d0bfeaf081 100644 --- a/plugins/love-resources/src/components/RoomConfigure.svelte +++ b/plugins/love-resources/src/components/RoomConfigure.svelte @@ -14,7 +14,7 @@ --> {#if value} diff --git a/plugins/love-resources/src/components/RoomPreview.svelte b/plugins/love-resources/src/components/RoomPreview.svelte index 4be877a545..1dd0f5de69 100644 --- a/plugins/love-resources/src/components/RoomPreview.svelte +++ b/plugins/love-resources/src/components/RoomPreview.svelte @@ -14,9 +14,8 @@ --> diff --git a/plugins/presence-resources/src/store.ts b/plugins/presence-resources/src/store.ts index af6c4b00d4..0234281ff0 100644 --- a/plugins/presence-resources/src/store.ts +++ b/plugins/presence-resources/src/store.ts @@ -16,7 +16,7 @@ import { type Doc, type Ref } from '@hcengineering/core' import { getCurrentEmployee, type Person } from '@hcengineering/contact' import { type PresenceData } from '@hcengineering/presence' -import { personByIdStore } from '@hcengineering/contact-resources' +import { getPersonByPersonRef } from '@hcengineering/contact-resources' import { type Readable, derived, writable, get } from 'svelte/store' import type { PersonRoomPresence, Room, RoomPresence, MyDataItem } from './types' @@ -29,7 +29,7 @@ export const otherPresence = writable(new Map()) export const followee = writable | undefined>(undefined) const personDataMap = new Map, Map>() -const followeeDataHandlers = new Map void>>() +const followeeDataHandlers = new Map Promise>>() export const presenceByObjectId = derived, Map, PersonRoomPresence[]>>( otherPresence, @@ -100,13 +100,13 @@ export function onPersonData (person: Ref, topic: string, data: any): vo const handlers = followeeDataHandlers.get(topic) if (handlers !== undefined) { for (const handler of handlers) { - handler(data) + void handler(data) } } } } -export function followeeDataSubscribe (topic: string, handler: (data: any) => void): void { +export function followeeDataSubscribe (topic: string, handler: (data: any) => Promise): void { const handlers = followeeDataHandlers.get(topic) if (handlers !== undefined) { handlers.add(handler) @@ -119,13 +119,13 @@ export function followeeDataSubscribe (topic: string, handler: (data: any) => vo if (followeeData !== undefined) { const data = followeeData.get(topic) if (data !== undefined) { - handler(data) + void handler(data) } } } } -export function followeeDataUnsubscribe (topic: string, handler: (data: any) => void): void { +export function followeeDataUnsubscribe (topic: string, handler: (data: any) => Promise): void { const handlers = followeeDataHandlers.get(topic) if (handlers !== undefined) { handlers.delete(handler) @@ -143,7 +143,7 @@ export function toggleFollowee (person: Ref | undefined): void { const handlers = followeeDataHandlers.get(topic) if (handlers !== undefined) { for (const handler of handlers) { - handler(data) + void handler(data) } } } @@ -151,19 +151,19 @@ export function toggleFollowee (person: Ref | undefined): void { } else { for (const handlers of followeeDataHandlers.values()) { for (const handler of handlers) { - handler(undefined) + void handler(undefined) } } } } -export function getFollowee (): Person | undefined { +export async function getFollowee (): Promise { const followeeId = get(followee) if (followeeId === undefined) { return undefined } - const personMap = get(personByIdStore) - return personMap.get(followeeId) + + return (await getPersonByPersonRef(followeeId)) ?? undefined } export function publishData (topic: string, data: any): void { diff --git a/plugins/presence/src/plugin.ts b/plugins/presence/src/plugin.ts index 02047fb3f6..67abca1728 100644 --- a/plugins/presence/src/plugin.ts +++ b/plugins/presence/src/plugin.ts @@ -31,9 +31,9 @@ export const presencePlugin = plugin(presenceId, { }, function: { PublishData: '' as Resource<(topic: string, data: any) => void>, - GetFollowee: '' as Resource<() => Person | undefined>, - FolloweeDataSubscribe: '' as Resource<(topic: string, handler: (data: any) => void) => void>, - FolloweeDataUnsubscribe: '' as Resource<(topic: string, handler: (data: any) => void) => void> + GetFollowee: '' as Resource<() => Promise>, + FolloweeDataSubscribe: '' as Resource<(topic: string, handler: (data: any) => Promise) => void>, + FolloweeDataUnsubscribe: '' as Resource<(topic: string, handler: (data: any) => Promise) => void> } }) diff --git a/plugins/products-resources/src/components/product/CreateProduct.svelte b/plugins/products-resources/src/components/product/CreateProduct.svelte index 9933c4fb2f..3abee361a5 100644 --- a/plugins/products-resources/src/components/product/CreateProduct.svelte +++ b/plugins/products-resources/src/components/product/CreateProduct.svelte @@ -23,7 +23,7 @@ import { type Product, ProductVersionState } from '@hcengineering/products' import { type Attachment } from '@hcengineering/attachment' import { AttachmentPresenter, AttachmentStyledBox } from '@hcengineering/attachment-resources' - import { AccountArrayEditor, personRefByAccountUuidStore } from '@hcengineering/contact-resources' + import { AccountArrayEditor, employeeRefByAccountUuidStore } from '@hcengineering/contact-resources' import core, { AccountUuid, Data, @@ -71,7 +71,7 @@ let typeId: Ref = products.spaceType.ProductType let spaceType: WithLookup | undefined - $: membersPersons = object.members.map((m) => $personRefByAccountUuidStore.get(m)).filter(notEmpty) + $: membersPersons = object.members.map((m) => $employeeRefByAccountUuidStore.get(m)).filter(notEmpty) let roles: Role[] = [] const rolesQuery = createQuery() diff --git a/plugins/request-resources/src/components/RequestDetail.svelte b/plugins/request-resources/src/components/RequestDetail.svelte index 9dc720fed6..20cf89fbb9 100644 --- a/plugins/request-resources/src/components/RequestDetail.svelte +++ b/plugins/request-resources/src/components/RequestDetail.svelte @@ -14,7 +14,7 @@ --> diff --git a/plugins/setting-resources/src/components/Profile.svelte b/plugins/setting-resources/src/components/Profile.svelte index 485607b0b1..df5b3ffe14 100644 --- a/plugins/setting-resources/src/components/Profile.svelte +++ b/plugins/setting-resources/src/components/Profile.svelte @@ -13,8 +13,8 @@ // limitations under the License. --> {#if object !== undefined} diff --git a/plugins/test-management-resources/src/components/project/CreateProject.svelte b/plugins/test-management-resources/src/components/project/CreateProject.svelte index 77ca86cfb2..08b5689305 100644 --- a/plugins/test-management-resources/src/components/project/CreateProject.svelte +++ b/plugins/test-management-resources/src/components/project/CreateProject.svelte @@ -15,7 +15,7 @@ diff --git a/plugins/time-resources/src/components/team/calendar/TeamCalendar.svelte b/plugins/time-resources/src/components/team/calendar/TeamCalendar.svelte index d76dd69d0a..3e6fe4a32b 100644 --- a/plugins/time-resources/src/components/team/calendar/TeamCalendar.svelte +++ b/plugins/time-resources/src/components/team/calendar/TeamCalendar.svelte @@ -15,13 +15,20 @@ - + - + {@const dayFrom = new Date(day).setHours(0, 0, 0, 0)} {@const dayTo = new Date(day).setHours(23, 59, 59, 999)} @@ -151,7 +171,7 @@ {@const planned = gitem?.mappings.reduce((it, val) => it + val.total, 0) ?? 0} {@const pevents = gitem?.events.reduce((it, val) => it + (val.dueDate - val.date), 0) ?? 0} {@const busy = gitem?.busy.slots.reduce((it, val) => it + (val.dueDate - val.date), 0) ?? 0} - {@const txInfo = group(txes.get(person) ?? [], dayFrom, dayTo)} + {@const txInfo = group(txesMap.get(person) ?? [], dayFrom, dayTo)}
diff --git a/plugins/time-resources/src/components/team/calendar/TeamCalendarDay.svelte b/plugins/time-resources/src/components/team/calendar/TeamCalendarDay.svelte index 97d391ada0..6f2d4dcc51 100644 --- a/plugins/time-resources/src/components/team/calendar/TeamCalendarDay.svelte +++ b/plugins/time-resources/src/components/team/calendar/TeamCalendarDay.svelte @@ -23,7 +23,7 @@ import { groupTeamData, toSlots } from '../utils' import EventElement from './EventElement.svelte' import PersonCalendar from './PersonCalendar.svelte' - import { personRefByAccountUuidStore } from '@hcengineering/contact-resources' + import { employeeRefByAccountUuidStore } from '@hcengineering/contact-resources' export let space: Ref export let currentDate: Date @@ -40,7 +40,7 @@ let todos: IdMap = new Map() $: persons = (project?.members ?? []) - .map((it) => $personRefByAccountUuidStore.get(it)) + .map((it) => $employeeRefByAccountUuidStore.get(it)) .filter((it) => it !== undefined) function calcHourWidth (events: Event[], totalWidth: number): number[] { diff --git a/plugins/tracker-resources/src/components/issues/AssigneeEditor.svelte b/plugins/tracker-resources/src/components/issues/AssigneeEditor.svelte index 5c2558599e..73e76697a6 100644 --- a/plugins/tracker-resources/src/components/issues/AssigneeEditor.svelte +++ b/plugins/tracker-resources/src/components/issues/AssigneeEditor.svelte @@ -14,7 +14,7 @@ -->
@@ -157,7 +165,7 @@
diff --git a/server/postgres/src/storage.ts b/server/postgres/src/storage.ts index c200bb4d5e..9eda327283 100644 --- a/server/postgres/src/storage.ts +++ b/server/postgres/src/storage.ts @@ -853,7 +853,7 @@ abstract class PostgresAdapterBase implements DbAdapter { for (const column in row) { if (column.startsWith('reverse_lookup_')) { if (row[column] != null) { - const join = reverseJoins.find((j) => j.toAlias === column) + const join = reverseJoins.find((j) => j.toAlias.toLowerCase() === column) if (join === undefined) { continue } diff --git a/services/github/github-resources/src/components/presenters/GithubReviewPresenter.svelte b/services/github/github-resources/src/components/presenters/GithubReviewPresenter.svelte index 0e060c4f14..d1ee736e80 100644 --- a/services/github/github-resources/src/components/presenters/GithubReviewPresenter.svelte +++ b/services/github/github-resources/src/components/presenters/GithubReviewPresenter.svelte @@ -7,12 +7,13 @@ import { GithubPullRequestReviewState, GithubReview } from '@hcengineering/github' import { ActivityMessageHeader, ActivityMessageTemplate } from '@hcengineering/activity-resources' - import { personByPersonIdStore } from '@hcengineering/contact-resources' + import { getPersonByPersonIdCb } from '@hcengineering/contact-resources' import { IntlString } from '@hcengineering/platform' import { MessageViewer } from '@hcengineering/presentation' import { isEmptyMarkup } from '@hcengineering/text' import { PaletteColorIndexes, getPlatformColor, themeStore } from '@hcengineering/ui' import github from '../../plugin' + import { Person } from '@hcengineering/contact' export let value: WithLookup export let showNotify: boolean = false @@ -22,7 +23,15 @@ export let embedded: boolean = false export let onClick: (() => void) | undefined = undefined - $: person = $personByPersonIdStore.get(value?.createdBy ?? value?.modifiedBy) + $: personId = value?.createdBy ?? value?.modifiedBy + let person: Person | undefined + $: if (personId !== undefined) { + getPersonByPersonIdCb(personId, (p) => { + person = p ?? undefined + }) + } else { + person = undefined + } function getCommentFromState (value?: GithubPullRequestReviewState): { label: IntlString diff --git a/services/github/github-resources/src/components/presenters/GithubReviewThreadPresenter.svelte b/services/github/github-resources/src/components/presenters/GithubReviewThreadPresenter.svelte index c8551d3040..309bfaf496 100644 --- a/services/github/github-resources/src/components/presenters/GithubReviewThreadPresenter.svelte +++ b/services/github/github-resources/src/components/presenters/GithubReviewThreadPresenter.svelte @@ -8,7 +8,7 @@ import { ActivityMessageHeader, ActivityMessageTemplate } from '@hcengineering/activity-resources' import { Person } from '@hcengineering/contact' - import { EmployeePresenter, personByPersonIdStore } from '@hcengineering/contact-resources' + import { EmployeePresenter, getPersonByPersonId, getPersonByPersonIdCb } from '@hcengineering/contact-resources' import { getEmbeddedLabel } from '@hcengineering/platform' import { createQuery, getClient } from '@hcengineering/presentation' import { ReferenceInput } from '@hcengineering/text-editor-resources' @@ -26,7 +26,15 @@ export let embedded: boolean = false export let onClick: (() => void) | undefined = undefined - $: person = $personByPersonIdStore.get(value?.createdBy ?? value?.modifiedBy) + $: personId = value?.createdBy ?? value?.modifiedBy + let person: Person | undefined + $: if (personId !== undefined) { + getPersonByPersonIdCb(personId, (p) => { + person = p ?? undefined + }) + } else { + person = undefined + } const commentsQuery = createQuery() @@ -141,24 +149,25 @@ /> {/if} {#if value.isResolved && value.resolvedBy != null} - {@const resolvePerson = $personByPersonIdStore.get(value.resolvedBy)} - {#if resolvePerson !== undefined} -
-