aboutsummaryrefslogtreecommitdiff
path: root/room.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-22 10:29:48 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-22 10:29:48 +0900
commit766f0cc7743724d830df30eca6899cad20ba1dc8 (patch)
tree529e1d390b42612950a6ff29d8392ca97d9f50f3 /room.cpp
parent3bfb1d9736e05fe216c016ae2dbb8eac4ac78048 (diff)
downloadlibquotient-766f0cc7743724d830df30eca6899cad20ba1dc8.tar.gz
libquotient-766f0cc7743724d830df30eca6899cad20ba1dc8.zip
Room::setLastReadEvent: don't update if the event is the same
Diffstat (limited to 'room.cpp')
-rw-r--r--room.cpp7
1 files changed, 5 insertions, 2 deletions
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,