aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-03-06 17:34:06 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-03-06 17:34:06 +0900
commitbcbdf7e418de975c43a0bd4bd8ecbeabd2f4ca0d (patch)
treebc06a7514ca0cf3af60eeedcca8d570b516c58b5
parentbc10ecd90b0bda973658db419bca88923b436ff3 (diff)
downloadlibquotient-bcbdf7e418de975c43a0bd4bd8ecbeabd2f4ca0d.tar.gz
libquotient-bcbdf7e418de975c43a0bd4bd8ecbeabd2f4ca0d.zip
Make sure the read marker is reinstated after Quaternion restart
-rw-r--r--room.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/room.cpp b/room.cpp
index beeca6e3..5fffec19 100644
--- a/room.cpp
+++ b/room.cpp
@@ -1472,9 +1472,9 @@ void Room::processEphemeralEvent(EventPtr event)
<< "as read for"
<< p.receipts.size() << "users";
}
- if (d->eventsIndex.contains(p.evtId))
+ const auto newMarker = findInTimeline(p.evtId);
+ if (newMarker != timelineEdge())
{
- const auto newMarker = findInTimeline(p.evtId);
for( const Receipt& r: p.receipts )
{
auto u = user(r.userId);
@@ -1536,7 +1536,11 @@ void Room::processAccountDataEvent(EventPtr event)
d->unreadMessages =
rmEvent->contentJson().value(UnreadMsgsKey).toBool();
d->serverReadMarker = readEventId;
- markMessagesAsRead(readEventId);
+ const auto newMarker = findInTimeline(readEventId);
+ if (newMarker != timelineEdge())
+ d->markMessagesAsRead(newMarker);
+ else
+ d->setLastReadEvent(localUser(), readEventId);
break;
}
default: