From 766f0cc7743724d830df30eca6899cad20ba1dc8 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 22 Jan 2018 10:29:48 +0900 Subject: Room::setLastReadEvent: don't update if the event is the same --- room.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'room.cpp') diff --git a/room.cpp b/room.cpp index 8c6465e2..d27bd5a3 100644 --- a/room.cpp +++ b/room.cpp @@ -302,7 +302,10 @@ void Room::setJoinState(JoinState state) void Room::Private::setLastReadEvent(User* u, const QString& eventId) { - lastReadEventIds.insert(u, eventId); + auto& storedId = lastReadEventIds[u]; + if (storedId == eventId) + return; + storedId = eventId; emit q->lastReadEventChanged(u); if (isLocalUser(u)) emit q->readMarkerMoved(); @@ -1151,7 +1154,7 @@ void Room::Private::checkUnreadMessages(timeline_iter_t from) const auto newUnreadMessages = count_if(from, timeline.cend(), std::bind(&Room::Private::isEventNotable, this, _1)); - // The first event in the just-added batch (referred to by upTo.base()) + // The first event in the just-added batch (referred to by `from`) // defines whose read marker can possibly be promoted any further over // the same author's events newly arrived. Others will need explicit // read receipts from the server (or, for the local user, -- cgit v1.2.3