UBERF-4161: Few inbox fixes (#3976)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-11-13 20:24:47 +07:00 committed by GitHub
parent 0a16c2ff88
commit 29b9296a0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 26 deletions

View File

@ -44,7 +44,7 @@
const empAccIds = dm?.members.length !== 1 ? dm?.members.filter((accId) => accId !== myAccId) : dm?.members const empAccIds = dm?.members.length !== 1 ? dm?.members.filter((accId) => accId !== myAccId) : dm?.members
const employeeAccounts = await client.findAll(contact.class.PersonAccount, { 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) return employeeAccounts.map((ea) => ea.person)

View File

@ -236,9 +236,10 @@ class Connection implements ClientConnection {
} }
} }
const request = this.requests.get(resp.id)
this.requests.delete(resp.id) this.requests.delete(resp.id)
if (resp.error !== undefined) { if (resp.error !== undefined) {
console.log('ERROR', promise, resp.id) console.log('ERROR', promise, request, resp.id)
promise.reject(new PlatformError(resp.error)) promise.reject(new PlatformError(resp.error))
} else { } else {
promise.resolve(resp.result) promise.resolve(resp.result)

View File

@ -18,6 +18,7 @@
import { IntlString } from '@hcengineering/platform' import { IntlString } from '@hcengineering/platform'
import { createQuery, getClient } from '@hcengineering/presentation' import { createQuery, getClient } from '@hcengineering/presentation'
import { ButtonKind, ButtonSize } from '@hcengineering/ui' import { ButtonKind, ButtonSize } from '@hcengineering/ui'
import { onDestroy } from 'svelte'
import { personAccountByIdStore } from '../utils' import { personAccountByIdStore } from '../utils'
import UserBoxList from './UserBoxList.svelte' import UserBoxList from './UserBoxList.svelte'
@ -30,16 +31,29 @@
export let width: string | undefined = undefined export let width: string | undefined = undefined
export let excludeItems: Ref<Account>[] | undefined = undefined export let excludeItems: Ref<Account>[] | undefined = undefined
let timer: any let timer: any = null
const client = getClient() const client = getClient()
let update: (() => Promise<void>) | undefined
function onUpdate (evt: CustomEvent<Ref<Employee>[]>): void { function onUpdate (evt: CustomEvent<Ref<Employee>[]>): void {
if (timer !== null) {
clearTimeout(timer) clearTimeout(timer)
timer = setTimeout(async () => { }
update = async () => {
const accounts = await client.findAll(contact.class.PersonAccount, { person: { $in: evt.detail } }) const accounts = await client.findAll(contact.class.PersonAccount, { person: { $in: evt.detail } })
onChange(accounts.map((it) => it._id)) 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() const excludedQuery = createQuery()

View File

@ -21,19 +21,19 @@
import EmptyAvatar from './icons/EmptyAvatar.svelte' import EmptyAvatar from './icons/EmptyAvatar.svelte'
export let _class: Ref<Class<Contact>> 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 size: IconSize
export let limit: number = 3 export let limit: number = 3
export let hideLimit: boolean = false export let hideLimit: boolean = false
let persons: Contact[] = [] let persons: Contact[] = []
$: includeEmpty = items.includes(undefined) || items.includes(null) $: includeEmpty = items?.includes(undefined) || items?.includes(null)
const query = createQuery() const query = createQuery()
$: query.query<Contact>( $: query.query<Contact>(
_class, _class,
{ _id: { $in: items.filter((p) => p) as Ref<Contact>[] } }, { _id: { $in: (items?.filter((p) => p) as Ref<Contact>[]) ?? [] } },
(result) => { (result) => {
persons = result persons = result
}, },
@ -48,6 +48,7 @@
} }
</script> </script>
{#if items !== undefined}
<div class="avatars-container"> <div class="avatars-container">
{#if includeEmpty} {#if includeEmpty}
<div class="combine-avatar {size}" data-over={getDataOver(persons.length === 0, items)}> <div class="combine-avatar {size}" data-over={getDataOver(persons.length === 0, items)}>
@ -60,6 +61,7 @@
</div> </div>
{/each} {/each}
</div> </div>
{/if}
<style lang="scss"> <style lang="scss">
.avatars-container { .avatars-container {

View File

@ -25,7 +25,7 @@
import IconMembers from './icons/Members.svelte' import IconMembers from './icons/Members.svelte'
import UsersPopup from './UsersPopup.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 _class: Ref<Class<Contact>> = contact.class.Contact
export let label: IntlString export let label: IntlString
export let docQuery: DocumentQuery<Contact> | undefined = {} export let docQuery: DocumentQuery<Contact> | undefined = {}
@ -42,7 +42,7 @@
const query = createQuery() const query = createQuery()
$: query.query<Contact>(_class, { _id: { $in: items } }, (result) => { $: query.query<Contact>(_class, { _id: { $in: items ?? [] } }, (result) => {
contacts = result contacts = result
}) })

View File

@ -40,8 +40,7 @@
createFocusManager, createFocusManager,
getCurrentResolvedLocation, getCurrentResolvedLocation,
navigate, navigate,
showPopup, showPopup
deviceOptionsStore as deviceInfo
} from '@hcengineering/ui' } from '@hcengineering/ui'
import { ContextMenu, DocNavLink, ParentsNavigator } from '@hcengineering/view-resources' import { ContextMenu, DocNavLink, ParentsNavigator } from '@hcengineering/view-resources'
import view from '@hcengineering/view' import view from '@hcengineering/view'
@ -251,7 +250,6 @@
placeholder={tracker.string.IssueTitlePlaceholder} placeholder={tracker.string.IssueTitlePlaceholder}
kind="large-style" kind="large-style"
on:blur={save} on:blur={save}
autoFocus={!$deviceInfo.isMobile}
/> />
<div class="w-full mt-6"> <div class="w-full mt-6">
<AttachmentStyleBoxEditor <AttachmentStyleBoxEditor