Fix inbox reading (#3390)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-06-07 20:06:59 +06:00 committed by GitHub
parent 316b8d810c
commit 5eaaa3f8a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,6 +49,7 @@
let _id: Ref<Doc> | undefined
let _class: Ref<Class<Doc>> | undefined
let selectedEmployee: Ref<EmployeeAccount> | undefined = undefined
const prevValue: DocUpdates | undefined = undefined
async function select (value: DocUpdates | undefined) {
if (!value) {
@ -57,17 +58,15 @@
_class = undefined
return
}
if (prevValue !== undefined) {
await client.update(prevValue, { txes: prevValue.txes })
}
const targetClass = hierarchy.getClass(value.attachedToClass)
const panelComponent = hierarchy.as(targetClass, view.mixin.ObjectPanel)
component = panelComponent.component ?? view.component.EditDoc
_id = value.attachedTo
_class = value.attachedToClass
await read(value)
}
async function read (docUpdate: DocUpdates): Promise<void> {
docUpdate.txes.forEach((p) => (p.isNew = false))
await client.update(docUpdate, { txes: docUpdate.txes })
value.txes.forEach((p) => (p.isNew = false))
}
function openDM (value: Ref<Doc>) {