UBER-267: Fix Users popup (#3268)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-05-27 16:44:38 +07:00 committed by GitHub
parent b95066d71a
commit 79486e1b8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View File

@ -130,6 +130,7 @@
const newPerson = await client.findOne(_class, { _id: res }) const newPerson = await client.findOne(_class, { _id: res })
if (newPerson !== undefined) { if (newPerson !== undefined) {
search = c.update?.(newPerson) ?? '' search = c.update?.(newPerson) ?? ''
dispatch('search', search)
} }
} }
}) })

View File

@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
--> -->
<script lang="ts"> <script lang="ts">
import { Contact, getFirstName, Person } from '@hcengineering/contact' import { Contact, getFirstName, getLastName, Person } from '@hcengineering/contact'
import type { Class, Doc, DocumentQuery, FindOptions, Ref } from '@hcengineering/core' import type { Class, Doc, DocumentQuery, FindOptions, Ref } from '@hcengineering/core'
import type { Asset, IntlString } from '@hcengineering/platform' import type { Asset, IntlString } from '@hcengineering/platform'
import presentation, { getClient, ObjectCreate, ObjectPopup } from '@hcengineering/presentation' import presentation, { getClient, ObjectCreate, ObjectPopup } from '@hcengineering/presentation'
@ -37,14 +37,15 @@
export let readonly = false export let readonly = false
const hierarchy = getClient().getHierarchy() const hierarchy = getClient().getHierarchy()
// const dispatch = createEventDispatcher()
$: _create = $: _create =
create !== undefined create !== undefined
? { ? {
...create, ...create,
update: (doc: Doc) => { update: (doc: Doc) => {
const name = getFirstName((doc as Contact).name) const name = getFirstName((doc as Contact).name).split(' ')[0]
return name.length > 0 ? name : (doc as Contact).name return name.length > 0 ? name : getLastName((doc as Contact).name).split(' ')[0]
} }
} }
: undefined : undefined

View File

@ -270,7 +270,7 @@
await applyOps.commit() await applyOps.commit()
draftController.remove() draftController.remove()
dispatch('close', object._id) dispatch('close', _id)
resetObject() resetObject()
} }