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