mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-26 13:01:48 +03:00
UBERF-4161: Few inbox fixes (#3976)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
0a16c2ff88
commit
29b9296a0e
@ -44,7 +44,7 @@
|
||||
const empAccIds = dm?.members.length !== 1 ? dm?.members.filter((accId) => accId !== myAccId) : dm?.members
|
||||
|
||||
const employeeAccounts = await client.findAll(contact.class.PersonAccount, {
|
||||
_id: { $in: empAccIds as Ref<PersonAccount>[] }
|
||||
_id: { $in: (empAccIds ?? []) as Ref<PersonAccount>[] }
|
||||
})
|
||||
|
||||
return employeeAccounts.map((ea) => ea.person)
|
||||
|
@ -236,9 +236,10 @@ class Connection implements ClientConnection {
|
||||
}
|
||||
}
|
||||
|
||||
const request = this.requests.get(resp.id)
|
||||
this.requests.delete(resp.id)
|
||||
if (resp.error !== undefined) {
|
||||
console.log('ERROR', promise, resp.id)
|
||||
console.log('ERROR', promise, request, resp.id)
|
||||
promise.reject(new PlatformError(resp.error))
|
||||
} else {
|
||||
promise.resolve(resp.result)
|
||||
|
@ -18,6 +18,7 @@
|
||||
import { IntlString } from '@hcengineering/platform'
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { ButtonKind, ButtonSize } from '@hcengineering/ui'
|
||||
import { onDestroy } from 'svelte'
|
||||
import { personAccountByIdStore } from '../utils'
|
||||
import UserBoxList from './UserBoxList.svelte'
|
||||
|
||||
@ -30,17 +31,30 @@
|
||||
export let width: string | undefined = undefined
|
||||
export let excludeItems: Ref<Account>[] | undefined = undefined
|
||||
|
||||
let timer: any
|
||||
let timer: any = null
|
||||
const client = getClient()
|
||||
let update: (() => Promise<void>) | undefined
|
||||
|
||||
function onUpdate (evt: CustomEvent<Ref<Employee>[]>): void {
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(async () => {
|
||||
if (timer !== null) {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
update = async () => {
|
||||
const accounts = await client.findAll(contact.class.PersonAccount, { person: { $in: evt.detail } })
|
||||
onChange(accounts.map((it) => it._id))
|
||||
}, 500)
|
||||
if (timer !== null) {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
timer = null
|
||||
update = undefined
|
||||
}
|
||||
timer = setTimeout(() => update?.(), 500)
|
||||
}
|
||||
|
||||
onDestroy(() => {
|
||||
update?.()
|
||||
})
|
||||
|
||||
const excludedQuery = createQuery()
|
||||
|
||||
let excluded: Account[] = []
|
||||
|
@ -21,19 +21,19 @@
|
||||
import EmptyAvatar from './icons/EmptyAvatar.svelte'
|
||||
|
||||
export let _class: Ref<Class<Contact>>
|
||||
export let items: (Ref<Contact> | undefined | null)[] = []
|
||||
export let items: (Ref<Contact> | undefined | null)[] | undefined = []
|
||||
export let size: IconSize
|
||||
export let limit: number = 3
|
||||
export let hideLimit: boolean = false
|
||||
|
||||
let persons: Contact[] = []
|
||||
|
||||
$: includeEmpty = items.includes(undefined) || items.includes(null)
|
||||
$: includeEmpty = items?.includes(undefined) || items?.includes(null)
|
||||
|
||||
const query = createQuery()
|
||||
$: query.query<Contact>(
|
||||
_class,
|
||||
{ _id: { $in: items.filter((p) => p) as Ref<Contact>[] } },
|
||||
{ _id: { $in: (items?.filter((p) => p) as Ref<Contact>[]) ?? [] } },
|
||||
(result) => {
|
||||
persons = result
|
||||
},
|
||||
@ -48,18 +48,20 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="avatars-container">
|
||||
{#if includeEmpty}
|
||||
<div class="combine-avatar {size}" data-over={getDataOver(persons.length === 0, items)}>
|
||||
<EmptyAvatar {size} />
|
||||
</div>
|
||||
{/if}
|
||||
{#each persons as person, i}
|
||||
<div class="combine-avatar {size}" data-over={getDataOver(persons.length === i + 1, items)}>
|
||||
<Avatar avatar={person.avatar} {size} name={person.name} />
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{#if items !== undefined}
|
||||
<div class="avatars-container">
|
||||
{#if includeEmpty}
|
||||
<div class="combine-avatar {size}" data-over={getDataOver(persons.length === 0, items)}>
|
||||
<EmptyAvatar {size} />
|
||||
</div>
|
||||
{/if}
|
||||
{#each persons as person, i}
|
||||
<div class="combine-avatar {size}" data-over={getDataOver(persons.length === i + 1, items)}>
|
||||
<Avatar avatar={person.avatar} {size} name={person.name} />
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style lang="scss">
|
||||
.avatars-container {
|
||||
|
@ -25,7 +25,7 @@
|
||||
import IconMembers from './icons/Members.svelte'
|
||||
import UsersPopup from './UsersPopup.svelte'
|
||||
|
||||
export let items: Ref<Contact>[] = []
|
||||
export let items: Ref<Contact>[] | undefined = []
|
||||
export let _class: Ref<Class<Contact>> = contact.class.Contact
|
||||
export let label: IntlString
|
||||
export let docQuery: DocumentQuery<Contact> | undefined = {}
|
||||
@ -42,7 +42,7 @@
|
||||
|
||||
const query = createQuery()
|
||||
|
||||
$: query.query<Contact>(_class, { _id: { $in: items } }, (result) => {
|
||||
$: query.query<Contact>(_class, { _id: { $in: items ?? [] } }, (result) => {
|
||||
contacts = result
|
||||
})
|
||||
|
||||
|
@ -40,8 +40,7 @@
|
||||
createFocusManager,
|
||||
getCurrentResolvedLocation,
|
||||
navigate,
|
||||
showPopup,
|
||||
deviceOptionsStore as deviceInfo
|
||||
showPopup
|
||||
} from '@hcengineering/ui'
|
||||
import { ContextMenu, DocNavLink, ParentsNavigator } from '@hcengineering/view-resources'
|
||||
import view from '@hcengineering/view'
|
||||
@ -251,7 +250,6 @@
|
||||
placeholder={tracker.string.IssueTitlePlaceholder}
|
||||
kind="large-style"
|
||||
on:blur={save}
|
||||
autoFocus={!$deviceInfo.isMobile}
|
||||
/>
|
||||
<div class="w-full mt-6">
|
||||
<AttachmentStyleBoxEditor
|
||||
|
Loading…
Reference in New Issue
Block a user