Fix updating read receipt
- Find the last event that wasn't sent by us to update the marker to, instead of picking whichever is the most recent - Use the proper event ID instead of ID that could be a local echo - Wait for the current marker update request to complete before trying to send a new one
This commit is contained in:
parent
106bb3546f
commit
5402a332d2
|
@ -6,6 +6,7 @@ import QtQuick.Window 2.12
|
||||||
import Clipboard 0.1
|
import Clipboard 0.1
|
||||||
import "../../.."
|
import "../../.."
|
||||||
import "../../../Base"
|
import "../../../Base"
|
||||||
|
import "../../../PythonBridge"
|
||||||
import "../../../ShortcutBundles"
|
import "../../../ShortcutBundles"
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -238,6 +239,8 @@ Rectangle {
|
||||||
property bool canLoad: true
|
property bool canLoad: true
|
||||||
property bool loading: false
|
property bool loading: false
|
||||||
|
|
||||||
|
property Future updateMarkerFuture: null
|
||||||
|
|
||||||
property bool ownEventsOnLeft:
|
property bool ownEventsOnLeft:
|
||||||
window.settings.ownMessagesOnLeftAboveWidth < 0 ?
|
window.settings.ownMessagesOnLeftAboveWidth < 0 ?
|
||||||
false :
|
false :
|
||||||
|
@ -353,16 +356,28 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
interval: window.settings.markRoomReadMsecDelay
|
interval: Math.max(100, window.settings.markRoomReadMsecDelay)
|
||||||
|
|
||||||
running:
|
running:
|
||||||
|
! eventList.updateMarkerFuture &&
|
||||||
(chat.roomInfo.unreads || chat.roomInfo.highlights) &&
|
(chat.roomInfo.unreads || chat.roomInfo.highlights) &&
|
||||||
Qt.application.state === Qt.ApplicationActive &&
|
Qt.application.state === Qt.ApplicationActive &&
|
||||||
(eventList.contentY + eventList.height) > -50
|
(eventList.contentY + eventList.height) > -50
|
||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
const eventId = eventList.model.get(0).id
|
for (let i = 0; i < eventList.model.count; i++) {
|
||||||
py.callCoro("update_room_read_marker", [chat.roomId, eventId])
|
const item = eventList.model.get(i)
|
||||||
|
|
||||||
|
if (item.sender !== chat.userId) {
|
||||||
|
eventList.updateMarkerFuture = py.callCoro(
|
||||||
|
"update_room_read_marker",
|
||||||
|
[chat.roomId, item.event_id],
|
||||||
|
() => { eventList.updateMarkerFuture = null },
|
||||||
|
() => { eventList.updateMarkerFuture = null },
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user