[UBERF-41] Chat notification fixes (#3630)

Signed-off-by: Oleg Solodkov <oleg.solodkov@xored.com>
This commit is contained in:
Oleg Solodkov 2023-08-25 14:53:00 +07:00 committed by GitHub
parent 2c585b2ecd
commit 3be2e0ea55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -105,11 +105,11 @@
function newMessagesStart (messages: Message[], docUpdates: Map<Ref<Doc>, DocUpdates>): number {
if (space === undefined) return -1
const docUpdate = docUpdates.get(space)
const lastView = docUpdate?.txes?.[0]?.modifiedOn
const lastView = docUpdate?.txes?.findLast((tx) => !tx.isNew)
if (docUpdate === undefined || lastView === undefined) return -1
for (let index = 0; index < messages.length; index++) {
const message = messages[index]
if ((message.createdOn ?? 0) >= lastView) return index
if ((message.createdOn ?? 0) >= lastView.modifiedOn) return index
}
return -1
}

View File

@ -105,7 +105,7 @@
function isChanged (space: Space, docUpdates: Map<Ref<Doc>, DocUpdates>): boolean {
const update = docUpdates.get(space._id)
if (update === undefined) return false
return update.txes.length > 0 && update.hidden !== true
return update.txes.filter((tx) => tx.isNew).length > 0 && update.hidden !== true
}
function getParentActions (): Action[] {