From ef4957eb544ccb3824c4e5ac00b724192b76f1f2 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sat, 24 Jul 2021 21:53:41 +0200 Subject: Room::setLastDisplayedEventId: Update local read receipt immediately There is no harm in updating it locally, as read receipts are only supposed to move forwards; if an update from another client of the same user arrives the next millisecond, it will only be incorporated if it points to an even newer event (exactly as would be expected). In any case, read receipts are more for others than for yourself. --- lib/room.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/room.cpp b/lib/room.cpp index 36735e40..1f239322 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -991,10 +991,12 @@ void Room::setLastDisplayedEventId(const QString& eventId) d->lastDisplayedEventId = eventId; emit lastDisplayedEventChanged(); - if (d->displayed && marker < readMarker(localUser())) + if (d->displayed && marker < readMarker(localUser())) { + d->setLastReadReceipt(localUser(), marker); connection()->callApi(BackgroundRequest, id(), QStringLiteral("m.read"), QUrl::toPercentEncoding(eventId)); + } } void Room::setLastDisplayedEvent(TimelineItem::index_t index) -- cgit v1.2.3