Fix inbox dot (#3407)

This commit is contained in:
Denis Bykhov 2023-06-08 21:49:57 +06:00 committed by GitHub
parent b9d134b7cf
commit 489351946f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 3 deletions

View File

@ -68,6 +68,7 @@
changeSelected(selected) changeSelected(selected)
} else { } else {
selected = index selected = index
markAsRead(selected)
} }
} }
} }
@ -76,11 +77,20 @@
$: changeSelected(selected) $: changeSelected(selected)
function markAsRead (index: number) {
if (filtered[index] !== undefined) {
filtered[index].txes.forEach((p) => (p.isNew = false))
filtered[index].txes = filtered[index].txes
filtered = filtered
}
}
function changeSelected (index: number) { function changeSelected (index: number) {
if (filtered[index] !== undefined) { if (filtered[index] !== undefined) {
listProvider.updateFocus(filtered[index]) listProvider.updateFocus(filtered[index])
_id = filtered[index]?.attachedTo _id = filtered[index]?.attachedTo
dispatch('change', filtered[index]) dispatch('change', filtered[index])
markAsRead(index)
} else if (filtered.length) { } else if (filtered.length) {
if (index < filtered.length - 1) { if (index < filtered.length - 1) {
selected++ selected++

View File

@ -64,6 +64,7 @@
changeSelected(selected) changeSelected(selected)
} else { } else {
selected = index selected = index
markAsRead(selected)
} }
} }
loading = false loading = false
@ -77,11 +78,20 @@
$: changeSelected(selected) $: changeSelected(selected)
function markAsRead (index: number) {
if (docs[index] !== undefined) {
docs[index].txes.forEach((p) => (p.isNew = false))
docs[index].txes = docs[index].txes
docs = docs
}
}
function changeSelected (index: number) { function changeSelected (index: number) {
if (docs[index] !== undefined) { if (docs[index] !== undefined) {
listProvider.updateFocus(docs[index]) listProvider.updateFocus(docs[index])
_id = docs[index]?.attachedTo _id = docs[index]?.attachedTo
dispatch('change', docs[index]) dispatch('change', docs[index])
markAsRead(index)
} else if (docs.length) { } else if (docs.length) {
if (index < docs.length - 1) { if (index < docs.length - 1) {
selected++ selected++

View File

@ -49,7 +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 let prevValue: DocUpdates | undefined = undefined
async function select (value: DocUpdates | undefined) { async function select (value: DocUpdates | undefined) {
if (!value) { if (!value) {
@ -59,14 +59,16 @@
return return
} }
if (prevValue !== undefined) { if (prevValue !== undefined) {
await client.update(prevValue, { txes: prevValue.txes }) prevValue.txes.forEach((p) => (p.isNew = false))
const txes = prevValue.txes
await client.update(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
value.txes.forEach((p) => (p.isNew = false)) prevValue = value
} }
function openDM (value: Ref<Doc>) { function openDM (value: Ref<Doc>) {