From bcbdf7e418de975c43a0bd4bd8ecbeabd2f4ca0d Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Tue, 6 Mar 2018 17:34:06 +0900 Subject: Make sure the read marker is reinstated after Quaternion restart --- room.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'room.cpp') 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: -- cgit v1.2.3