aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-07-24 21:53:41 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-07-24 21:53:41 +0200
commitef4957eb544ccb3824c4e5ac00b724192b76f1f2 (patch)
tree873ee2164cf3513076167992f0c970c7dd72a60c
parent2f35303d2fbcf0e0fc9727c327a6c98f2da8648d (diff)
downloadlibquotient-ef4957eb544ccb3824c4e5ac00b724192b76f1f2.tar.gz
libquotient-ef4957eb544ccb3824c4e5ac00b724192b76f1f2.zip
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.
-rw-r--r--lib/room.cpp4
1 files changed, 3 insertions, 1 deletions
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<PostReceiptJob>(BackgroundRequest, id(),
QStringLiteral("m.read"),
QUrl::toPercentEncoding(eventId));
+ }
}
void Room::setLastDisplayedEvent(TimelineItem::index_t index)