uberf-11415: fix formatting

Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
Alexey Zinoviev 2025-06-07 03:07:21 +04:00
parent 33411b6253
commit 668675b080
No known key found for this signature in database
34 changed files with 283 additions and 256 deletions

View File

@ -256,7 +256,10 @@ export async function combineActivityMessages (
const result: Array<DisplayActivityMessage | undefined> = [...uncombined]
const groupedByType: Map<string, DocUpdateMessage[]> = await groupByArrayAsync(docUpdateMessages, getDocUpdateMessageKey)
const groupedByType: Map<string, DocUpdateMessage[]> = await groupByArrayAsync(
docUpdateMessages,
getDocUpdateMessageKey
)
for (const [, groupedMessages] of groupedByType) {
const cantMerge = groupedMessages.filter(

View File

@ -17,11 +17,7 @@
import { DocAttributeUpdates, DocUpdateMessage } from '@hcengineering/activity'
import { Employee, Person } from '@hcengineering/contact'
import { AccountUuid, notEmpty, PersonId } from '@hcengineering/core'
import {
PersonPresenter,
employeeByAccountStore,
employeeByPersonIdStore
} from '@hcengineering/contact-resources'
import { PersonPresenter, employeeByAccountStore, employeeByPersonIdStore } from '@hcengineering/contact-resources'
import { ChunterSpace } from '@hcengineering/chunter'
import { Label } from '@hcengineering/ui'
import view from '@hcengineering/view'

View File

@ -19,10 +19,7 @@
import { AttachmentDocList, AttachmentImageSize } from '@hcengineering/attachment-resources'
import chunter, { ChatMessage, ChatMessageViewlet } from '@hcengineering/chunter'
import contact, { getCurrentEmployee, Person, SocialIdentity } from '@hcengineering/contact'
import {
getPersonByPersonId,
getSocialIdByPersonId
} from '@hcengineering/contact-resources'
import { getPersonByPersonId, getSocialIdByPersonId } 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'

View File

@ -80,7 +80,7 @@
author = $employeeByPersonIdStore.get(socialId)
if (author === undefined) {
author = await getPersonByPersonId(socialId) ?? undefined
author = (await getPersonByPersonId(socialId)) ?? undefined
}
}

View File

@ -43,29 +43,20 @@ export default class ContactCacheStoreManager {
}
private readonly _personRefByPersonIdStoreBase = writable<Map<PersonId, Ref<Person> | null>>(new Map())
private readonly _personRefByPersonIdStore = derived(
[this._personRefByPersonIdStoreBase],
([store]) => {
private readonly _personRefByPersonIdStore = derived([this._personRefByPersonIdStoreBase], ([store]) => {
return new Map(Array.from(store.entries()).filter(notEmptyValue))
}
)
})
private readonly _personByPersonIdStoreBase = writable<Map<PersonId, Readonly<Person> | null>>(new Map())
private readonly _personByPersonIdStore = derived(
[this._personByPersonIdStoreBase],
([store]) => {
private readonly _personByPersonIdStore = derived([this._personByPersonIdStoreBase], ([store]) => {
return new Map(Array.from(store.entries()).filter(notEmptyValue))
}
)
})
private readonly _personByPersonRefStoreBase = writable<Map<Ref<Person>, Readonly<Person> | null>>(new Map())
private readonly _personByPersonRefStore = derived(
[this._personByPersonRefStoreBase],
([store]) => {
private readonly _personByPersonRefStore = derived([this._personByPersonRefStoreBase], ([store]) => {
return new Map(Array.from(store.entries()).filter(notEmptyValue))
}
)
})
public getPersonRefByPersonIdStore (personIds: PersonId[]): Readable<Map<PersonId, Ref<Person>>> {
if (personIds.length > 0) {

View File

@ -86,9 +86,7 @@
void update?.()
})
$: employees = (value ?? [])
.map((p) => $employeeRefByAccountUuidStore.get(p))
.filter(notEmpty)
$: employees = (value ?? []).map((p) => $employeeRefByAccountUuidStore.get(p)).filter(notEmpty)
$: docQuery =
excludeItems.length === 0 && includeItems.length === 0
? {}

View File

@ -37,9 +37,7 @@
? {}
: {
_id: {
$in: include
.map((personId) => $employeeByPersonIdStore.get(personId)?._id)
.filter(notEmpty)
$in: include.map((personId) => $employeeByPersonIdStore.get(personId)?._id).filter(notEmpty)
}
}
$: selectedEmp = value != null ? $employeeByPersonIdStore.get(value)?._id : value

View File

@ -88,10 +88,7 @@
</div>
<Button
on:click={() => {
dispatch(
'close',
memberAccountsToAdd
)
dispatch('close', memberAccountsToAdd)
}}
label={presentation.string.Add}
/>

View File

@ -79,10 +79,11 @@
$: personByRefStore = getPersonByPersonRefStore(value != null ? [value] : [])
const updateSelected = reduceCalls(async function (value: Ref<Person> | null | undefined, personByRefStore: Map<Ref<Person>, Readonly<Person>>) {
selected = value
? personByRefStore.get(value) ?? undefined
: undefined
const updateSelected = reduceCalls(async function (
value: Ref<Person> | null | undefined,
personByRefStore: Map<Ref<Person>, Readonly<Person>>
) {
selected = value ? personByRefStore.get(value) ?? undefined : undefined
})
$: void updateSelected(value, $personByRefStore)

View File

@ -34,9 +34,11 @@
const objectArray = Array.isArray(object) ? object : [object]
const dispatch = createEventDispatcher()
let creators: Ref<Person>[]
$: void getPersonRefsByPersonIds(Array.from(new Set(objectArray.map((obj) => obj.createdBy).filter(notEmpty)))).then((refs) => {
$: void getPersonRefsByPersonIds(Array.from(new Set(objectArray.map((obj) => obj.createdBy).filter(notEmpty)))).then(
(refs) => {
creators = Array.from(refs.values())
})
}
)
$: canDelete =
(skipCheck ||

View File

@ -30,7 +30,7 @@
const client = getClient()
const h = client.getHierarchy()
$: person = typeof value === 'string' ? ($employeeByIdStore.get(value as Ref<Employee>)) : (value as Person)
$: person = typeof value === 'string' ? $employeeByIdStore.get(value as Ref<Employee>) : (value as Person)
$: employeeValue = person != null ? h.as(person, contact.mixin.Employee) : undefined
$: active = employeeValue?.active ?? false
</script>

View File

@ -40,7 +40,8 @@
let update: (() => Promise<void>) | undefined
$: valueByPersonRef = new Map<Ref<Employee>, PersonId>(
value.map((p) => {
value
.map((p) => {
const employee = $employeeByPersonIdStore.get(p)
const ref = employee?._id
@ -50,7 +51,8 @@
}
return [ref, p] as const
}).filter(notEmpty)
})
.filter(notEmpty)
)
function onUpdate (evt: CustomEvent<Ref<Employee>[]>): void {

View File

@ -393,7 +393,10 @@ onClient(() => {
channelProviders.set(res)
})
employeesQuery.query(contact.mixin.Employee, { active: { $in: [true, false] } }, (res) => {
employeesQuery.query(
contact.mixin.Employee,
{ active: { $in: [true, false] } },
(res) => {
const personIdToEmployee = new Map<PersonId, Employee>()
const socialKeyToEmployee = new Map<string, Employee>()
for (const employee of res) {
@ -407,7 +410,10 @@ onClient(() => {
}
employeeByPersonIdStore.set(personIdToEmployee)
employeeBySocialKeyStore.set(socialKeyToEmployee)
primarySocialIdByEmployeeRefStore.set(new Map(res.map((e) => {
primarySocialIdByEmployeeRefStore.set(
new Map(
res
.map((e) => {
const socialIds = (e.$lookup?.socialIds ?? []) as SocialIdentity[]
const primaryId = socialIds.length !== 0 ? pickPrimarySocialId(socialIds) : undefined
if (primaryId === undefined) {
@ -415,7 +421,10 @@ onClient(() => {
}
return [e._id, primaryId._id] as const
}).filter(notEmpty)))
})
.filter(notEmpty)
)
)
// Remove lookups before storing the map as the interface doesn't expose it anyways
for (const employee of res) {
@ -429,11 +438,13 @@ onClient(() => {
res.filter((p) => p.active && p.personUuid != null).map((p) => [p.personUuid as AccountUuid, p._id] as const)
)
)
}, {
},
{
lookup: {
_id: { socialIds: contact.class.SocialIdentity }
}
})
}
)
})
const userStatusesQuery = createQuery(true)
@ -666,7 +677,9 @@ export function getPermittedPersons (
const spacesStore = writable<Space[]>([])
export const permissionsStore = derived([spacesStore, employeeRefByAccountUuidStore], ([spaces, personRefByAccount]) => {
export const permissionsStore = derived(
[spacesStore, employeeRefByAccountUuidStore],
([spaces, personRefByAccount]) => {
const whitelistedSpaces = new Set<Ref<Space>>()
const permissionsBySpace: PermissionsBySpace = {}
const employeesByPermission: PersonsByPermission = {}
@ -724,7 +737,8 @@ export const permissionsStore = derived([spacesStore, employeeRefByAccountUuidSt
ms: membersBySpace,
whitelist: whitelistedSpaces
}
})
}
)
const spaceTypesQuery = createQuery(true)
const permissionsQuery = createQuery(true)
@ -791,7 +805,9 @@ export async function getPersonByPersonRef (personRef: Ref<Person>): Promise<Per
return await getPersonByPersonRefBase(client, personRef)
}
export async function getPersonsByPersonRefs (personRefs: Array<Ref<Person>>): Promise<Map<Ref<Person>, Readonly<Person>>> {
export async function getPersonsByPersonRefs (
personRefs: Array<Ref<Person>>
): Promise<Map<Ref<Person>, Readonly<Person>>> {
const client = getClient()
return await getPersonsByPersonRefsBase(client, personRefs)
@ -815,6 +831,8 @@ export function getPersonByPersonIdStore (personIds: PersonId[]): Readable<Map<P
return contactCacheStoreManager.getPersonByPersonIdStore(personIds)
}
export function getPersonByPersonRefStore (personRefs: Array<Ref<Person>>): Readable<Map<Ref<Person>, Readonly<Person>>> {
export function getPersonByPersonRefStore (
personRefs: Array<Ref<Person>>
): Readable<Map<Ref<Person>, Readonly<Person>>> {
return contactCacheStoreManager.getPersonByPersonRefStore(personRefs)
}

View File

@ -212,7 +212,9 @@ export default class ContactCache {
const person = this._personByRef.get(ref)
if (person == null) return
const updatedPerson = isUpdateTx(tx) ? TxProcessor.updateDoc2Doc(person, tx) : TxProcessor.updateMixin4Doc(person, tx)
const updatedPerson = isUpdateTx(tx)
? TxProcessor.updateDoc2Doc(person, tx)
: TxProcessor.updateMixin4Doc(person, tx)
this._personByRef.set(ref, updatedPerson)
const personIds = Array.from(this._personIdsByPersonRef.get(ref) ?? [])
for (const personId of personIds) {

View File

@ -37,7 +37,16 @@ import {
} from '@hcengineering/core'
import { getMetadata } from '@hcengineering/platform'
import { ColorDefinition } from '@hcengineering/ui'
import contact, { AvatarProvider, AvatarType, Channel, Contact, Employee, Person, SocialIdentity, SocialIdentityRef } from '.'
import contact, {
AvatarProvider,
AvatarType,
Channel,
Contact,
Employee,
Person,
SocialIdentity,
SocialIdentityRef
} from '.'
import { AVATAR_COLORS, GravatarPlaceholderType } from './types'
import ContactCache from './cache'
@ -553,7 +562,8 @@ export async function loadCachesForPersonId (client: Client, personId: PersonId)
}
export async function loadCachesForPersonIds (client: Client, personIds: PersonId[]): Promise<void> {
const sidObjsMap = toIdMap(await client.findAll(
const sidObjsMap = toIdMap(
await client.findAll(
contact.class.SocialIdentity,
{
_id: { $in: personIds as SocialIdentityRef[] }
@ -563,7 +573,8 @@ export async function loadCachesForPersonIds (client: Client, personIds: PersonI
attachedTo: contact.class.Person
}
}
))
)
)
for (const personId of personIds) {
const sidObj = sidObjsMap.get(personId as SocialIdentityRef)
@ -589,7 +600,8 @@ export async function loadCachesForPersonRef (client: Client, personRef: Ref<Per
}
export async function loadCachesForPersonRefs (client: Client, personRefs: Array<Ref<Person>>): Promise<void> {
const persons = toIdMap(await client.findAll(
const persons = toIdMap(
await client.findAll(
contact.class.Person,
{
_id: { $in: personRefs }
@ -599,7 +611,8 @@ export async function loadCachesForPersonRefs (client: Client, personRefs: Array
_id: { socialIds: contact.class.SocialIdentity }
}
}
))
)
)
for (const personRef of personRefs) {
const person = persons.get(personRef)
@ -616,15 +629,22 @@ export async function getPersonRefByPersonId (client: Client, personId: PersonId
return contactCache.personRefByPersonId.get(personId) ?? null
}
export async function getPersonRefsByPersonIds (client: Client, personIds: PersonId[]): Promise<Map<PersonId, Ref<Person>>> {
export async function getPersonRefsByPersonIds (
client: Client,
personIds: PersonId[]
): Promise<Map<PersonId, Ref<Person>>> {
if (personIds.some((personId) => !contactCache.personRefByPersonId.has(personId))) {
await loadCachesForPersonIds(client, personIds)
}
return new Map(personIds.map((pid) => {
return new Map(
personIds
.map((pid) => {
const ref = contactCache.personRefByPersonId.get(pid)
return ref != null ? [pid, ref] as const : undefined
}).filter(notEmpty))
return ref != null ? ([pid, ref] as const) : undefined
})
.filter(notEmpty)
)
}
export async function getPersonByPersonId (client: Client, personId: PersonId): Promise<Readonly<Person> | null> {
@ -635,15 +655,22 @@ export async function getPersonByPersonId (client: Client, personId: PersonId):
return contactCache.personByPersonId.get(personId) ?? null
}
export async function getPersonsByPersonIds (client: Client, personIds: PersonId[]): Promise<Map<PersonId, Readonly<Person>>> {
export async function getPersonsByPersonIds (
client: Client,
personIds: PersonId[]
): Promise<Map<PersonId, Readonly<Person>>> {
if (personIds.some((personId) => !contactCache.personByPersonId.has(personId))) {
await loadCachesForPersonIds(client, personIds)
}
return new Map(personIds.map((pid) => {
return new Map(
personIds
.map((pid) => {
const person = contactCache.personByPersonId.get(pid)
return person != null ? [pid, person] as const : undefined
}).filter(notEmpty))
return person != null ? ([pid, person] as const) : undefined
})
.filter(notEmpty)
)
}
export async function getPersonByPersonRef (client: Client, personRef: Ref<Person>): Promise<Readonly<Person> | null> {
@ -654,15 +681,22 @@ export async function getPersonByPersonRef (client: Client, personRef: Ref<Perso
return contactCache.personByRef.get(personRef) ?? null
}
export async function getPersonsByPersonRefs (client: Client, personRefs: Array<Ref<Person>>): Promise<Map<Ref<Person>, Readonly<Person>>> {
export async function getPersonsByPersonRefs (
client: Client,
personRefs: Array<Ref<Person>>
): Promise<Map<Ref<Person>, Readonly<Person>>> {
if (personRefs.some((personRef) => !contactCache.personByRef.has(personRef))) {
await loadCachesForPersonRefs(client, personRefs)
}
return new Map(personRefs.map((personRef) => {
return new Map(
personRefs
.map((personRef) => {
const person = contactCache.personByRef.get(personRef)
return person != null ? [personRef, person] as const : undefined
}).filter(notEmpty))
return person != null ? ([personRef, person] as const) : undefined
})
.filter(notEmpty)
)
}
export async function getSocialIdByPersonId (client: Client, personId: PersonId): Promise<SocialIdentity | null> {

View File

@ -47,15 +47,12 @@
}
let workflow: Map<Ref<ControlledDocument>, DocumentValidationState[]>
$: void extractValidationWorkflow(
hierarchy,
{
$: void extractValidationWorkflow(hierarchy, {
...emptyBundle(),
ControlledDocument: doc ? [doc] : [],
DocumentRequest: requests,
DocumentSnapshot: $documentSnapshots
}
).then((res) => {
}).then((res) => {
workflow = res
})

View File

@ -46,16 +46,13 @@
}
let workflow: Map<Ref<ControlledDocument>, DocumentValidationState[]>
$: void extractValidationWorkflow(
hierarchy,
{
$: void extractValidationWorkflow(hierarchy, {
...emptyBundle(),
ControlledDocument: doc ? [doc] : [],
DocumentRequest: requests,
DocumentSnapshot: $documentSnapshots,
ChatMessage: messages
}
).then((res) => {
}).then((res) => {
workflow = res
})

View File

@ -1123,7 +1123,9 @@ export async function extractValidationWorkflow (
const anchor = review ?? approval
const author =
anchor?.createdBy !== undefined ? await getPersonRefByPersonId(anchor.createdBy) ?? document.author : document.author
anchor?.createdBy !== undefined
? (await getPersonRefByPersonId(anchor.createdBy)) ?? document.author
: document.author
state.approvals = [
{
@ -1132,8 +1134,8 @@ export async function extractValidationWorkflow (
state: anchor !== undefined ? 'approved' : 'waiting',
timestamp: anchor !== undefined ? anchor.createdOn ?? document.createdOn : undefined
},
...await getApprovalStates(review),
...await getApprovalStates(approval)
...(await getApprovalStates(review)),
...(await getApprovalStates(approval))
]
if (state.requests.length > 0) {

View File

@ -81,7 +81,7 @@
object._class,
'gmailSharedMessages',
{
messages: convertMessages(object, channel, selectedMessages)
messages: await convertMessages(object, channel, selectedMessages)
}
)
await inboxClient.readDoc(channel._id)
@ -126,12 +126,14 @@
</div>
{#if messages && messages.length > 0}
{#await convertMessages(object, channel, messages) then convertedMessages}
<div class="antiVSpacer x2" />
<Scroller padding={'.5rem 1rem'}>
<Messages messages={convertMessages(object, channel, messages)} {selectable} bind:selected on:select />
<Messages messages={convertedMessages} {selectable} bind:selected on:select />
<div class="antiVSpacer x2" />
</Scroller>
<div class="antiVSpacer x2" />
{/await}
{:else}
<div class="flex-col-center justify-center h-full">
<Icon icon={IconInbox} size={'full'} />

View File

@ -65,7 +65,11 @@ export async function checkHasEmail (doc: Doc | Doc[] | undefined): Promise<bool
const EMAIL_REGEX =
/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/
export async function convertMessages (object: Contact, channel: Channel, messages: Message[]): Promise<SharedMessage[]> {
export async function convertMessages (
object: Contact,
channel: Channel,
messages: Message[]
): Promise<SharedMessage[]> {
const res: SharedMessage[] = []
for (const m of messages) {
res.push({

View File

@ -37,7 +37,7 @@
author = $employeeByPersonIdStore.get(socialId)
if (author === undefined) {
author = await getPersonByPersonId(socialId) ?? undefined
author = (await getPersonByPersonId(socialId)) ?? undefined
}
}
</script>

View File

@ -12,13 +12,13 @@
<!-- limitations under the License. -->
<script lang="ts">
import { getClient, LiteMessageViewer } from '@hcengineering/presentation'
import { LiteMessageViewer } from '@hcengineering/presentation'
import { Card } from '@hcengineering/card'
import { type WithLookup } from '@hcengineering/core'
import { Message, MessageType, SocialID } from '@hcengineering/communication-types'
import { getPersonBySocialId, Person } from '@hcengineering/contact'
import { Person } from '@hcengineering/contact'
import { getEmbeddedLabel, IntlString } from '@hcengineering/platform'
import { personByPersonIdStore } from '@hcengineering/contact-resources'
import { employeeByPersonIdStore, getPersonByPersonId } from '@hcengineering/contact-resources'
import { markdownToMarkup } from '@hcengineering/text-markdown'
import { jsonToMarkup, markupToText } from '@hcengineering/text'
import { ActivityMessageViewer, ThreadMessageViewer, isActivityMessage } from '@hcengineering/communication-resources'
@ -33,8 +33,6 @@
export let kind: 'default' | 'column' = 'default'
export let padding: string | undefined = undefined
const client = getClient()
const tooltipLimit = 512
let person: WithLookup<Person> | undefined = undefined
@ -50,7 +48,7 @@
}
async function updatePerson (socialId: SocialID): Promise<void> {
person = $personByPersonIdStore.get(socialId) ?? (await getPersonBySocialId(client, socialId))
person = $employeeByPersonIdStore.get(socialId) ?? (await getPersonByPersonId(socialId)) ?? undefined
}
</script>

View File

@ -12,12 +12,11 @@
<!-- limitations under the License. -->
<script lang="ts">
import { Person, formatName, getPersonBySocialId } from '@hcengineering/contact'
import { Person, formatName } from '@hcengineering/contact'
import { IntlString } from '@hcengineering/platform'
import { resizeObserver, TimeSince, tooltip } from '@hcengineering/ui'
import { Avatar, PersonPreviewProvider, SystemAvatar, personByPersonIdStore } from '@hcengineering/contact-resources'
import { Avatar, PersonPreviewProvider, SystemAvatar, employeeByPersonIdStore, getPersonByPersonId } from '@hcengineering/contact-resources'
import { SocialID } from '@hcengineering/communication-types'
import { getClient } from '@hcengineering/presentation'
export let tooltipLabel: IntlString | undefined = undefined
export let person: Person | undefined = undefined
@ -28,7 +27,6 @@
export let padding: string | undefined = undefined
export let fixHeight: boolean = false
const client = getClient()
let clientWidth: number
$: showPersonName = clientWidth > 300
@ -37,9 +35,9 @@
$: void updatePerson(socialId, person)
async function updatePerson (socialId: SocialID, person: Person | undefined): Promise<void> {
_person = person ?? $personByPersonIdStore.get(socialId)
_person = person ?? $employeeByPersonIdStore.get(socialId)
if (!_person) {
_person = await getPersonBySocialId(client, socialId)
_person = await getPersonByPersonId(socialId) ?? undefined
}
}
</script>

View File

@ -221,12 +221,7 @@
{/each}
{/each}
<div class="floorGrid-configureRoom__header">
<EditBox
bind:value={room.name}
on:change={updateName}
placeholder={roomLabel}
kind={'editbox'}
/>
<EditBox bind:value={room.name} on:change={updateName} placeholder={roomLabel} kind={'editbox'} />
{#if showButtons}
<div
class="flex-row-center flex-no-shrink h-full {zoomOut ? 'flex-gap-1' : 'flex-gap-2'}"

View File

@ -52,7 +52,7 @@
return
}
return await getPersonByPersonRef(info.person) ?? undefined
return (await getPersonByPersonRef(info.person)) ?? undefined
}
function getPersonInfo (y: number, x: number, info: ParticipantInfo[]): ParticipantInfo | undefined {

View File

@ -42,7 +42,12 @@
})
.map((room) => makeRoomItem(room, false))
$: personByRefStore = getPersonByPersonRefStore($rooms.filter(isOffice).map((r) => r.person).filter(notEmpty))
$: personByRefStore = getPersonByPersonRefStore(
$rooms
.filter(isOffice)
.map((r) => r.person)
.filter(notEmpty)
)
$: selectedRoom = $rooms.find((p) => p._id === value)
$: selected = selectedRoom !== undefined ? makeRoomItem(selectedRoom, true) : undefined

View File

@ -14,7 +14,6 @@ import core, {
generateId,
getCurrentAccount,
type Hierarchy,
type IdMap,
type Ref,
type RelatedDocument,
type Space,

View File

@ -107,7 +107,7 @@
const result: Array<InboxNotification[]> = []
let group: InboxNotification[] = []
let person: Ref<Person> | undefined = undefined
const personRefByPersonId = await getPersonRefsByPersonIds(notifications.map(it => it.createdBy ?? it.modifiedBy))
const personRefByPersonId = await getPersonRefsByPersonIds(notifications.map((it) => it.createdBy ?? it.modifiedBy))
for (const it of notifications) {
const pid = it.createdBy ?? it.modifiedBy

View File

@ -163,7 +163,7 @@ export async function getFollowee (): Promise<Person | undefined> {
return undefined
}
return await getPersonByPersonRef(followeeId) ?? undefined
return (await getPersonByPersonRef(followeeId)) ?? undefined
}
export function publishData (topic: string, data: any): void {

View File

@ -32,8 +32,8 @@ 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>
FolloweeDataSubscribe: '' as Resource<(topic: string, handler: (data: any) => Promise<void>) => void>,
FolloweeDataUnsubscribe: '' as Resource<(topic: string, handler: (data: any) => Promise<void>) => void>
}
})

View File

@ -29,11 +29,13 @@
$: query.query(request.mixin.RequestDecisionComment, { attachedTo: value._id }, (res) => {
comments = res
})
$: void getPersonRefsByPersonIds(comments.map(it => it.modifiedBy)).then((res) => {
commentsByPersonRefs = new Map(comments.map((c) => {
$: void getPersonRefsByPersonIds(comments.map((it) => it.modifiedBy)).then((res) => {
commentsByPersonRefs = new Map(
comments.map((c) => {
const personRef = res.get(c.modifiedBy)
return [personRef, c]
}))
})
)
})
interface RequestDecision {

View File

@ -16,10 +16,7 @@
import calendar, { Event, getAllEvents } from '@hcengineering/calendar'
import { calendarByIdStore } from '@hcengineering/calendar-resources'
import contact, { getCurrentEmployee, Person } from '@hcengineering/contact'
import {
employeeRefByAccountUuidStore,
getPersonRefsByPersonIds
} from '@hcengineering/contact-resources'
import { employeeRefByAccountUuidStore, getPersonRefsByPersonIds } from '@hcengineering/contact-resources'
import core, { Doc, IdMap, PersonId, Ref, Timestamp, Tx, TxCreateDoc, TxCUD, TxUpdateDoc } from '@hcengineering/core'
import { Asset } from '@hcengineering/platform'
import { createQuery, getClient } from '@hcengineering/presentation'
@ -59,13 +56,9 @@
const socialIdsQuery = createQuery()
$: if (personsRefs.length > 0) {
socialIdsQuery.query(
contact.class.SocialIdentity,
{ attachedTo: { $in: personsRefs } },
(res) => {
socialIdsQuery.query(contact.class.SocialIdentity, { attachedTo: { $in: personsRefs } }, (res) => {
personsSocialIds = res.map((si) => si._id).flat()
}
)
})
} else {
socialIdsQuery.unsubscribe()
}
@ -77,7 +70,7 @@
txes = res
}
)
$: void getPersonRefsByPersonIds(Array.from(new Set(txes.map(it => it.createdBy ?? it.modifiedBy)))).then((res) => {
$: void getPersonRefsByPersonIds(Array.from(new Set(txes.map((it) => it.createdBy ?? it.modifiedBy)))).then((res) => {
const map = new Map<Ref<Person>, Tx[]>()
for (const t of txes) {
const personId = t.createdBy ?? t.modifiedBy

View File

@ -15,11 +15,7 @@
<script lang="ts">
import { Analytics } from '@hcengineering/analytics'
import { Employee } from '@hcengineering/contact'
import {
AccountArrayEditor,
AssigneeBox,
employeeRefByAccountUuidStore
} from '@hcengineering/contact-resources'
import { AccountArrayEditor, AssigneeBox, employeeRefByAccountUuidStore } from '@hcengineering/contact-resources'
import core, {
Data,
DocumentUpdate,

View File

@ -32,7 +32,7 @@
async function getPerson (id: PersonId | undefined): Promise<void> {
if (id !== undefined) {
person = await getPersonRefByPersonId(client, id)
person = await getPersonRefByPersonId(client, id) ?? undefined
}
}
</script>