From 4ef72d95868451b7e53bd49a873648332a121130 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Wed, 28 Jul 2021 03:33:24 +0200 Subject: setFirst/LastDisplayedEvent(): warn about unloaded events --- lib/room.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/room.cpp b/lib/room.cpp index 076fd8c8..10e827d7 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -909,6 +909,11 @@ void Room::setFirstDisplayedEventId(const QString& eventId) if (d->firstDisplayedEventId == eventId) return; + if (!eventId.isEmpty() && findInTimeline(eventId) == historyEdge()) + qCWarning(MESSAGES) + << eventId + << "is marked as first displayed but doesn't seem to be loaded"; + d->firstDisplayedEventId = eventId; emit firstDisplayedEventChanged(); } @@ -931,6 +936,12 @@ void Room::setLastDisplayedEventId(const QString& eventId) if (d->lastDisplayedEventId == eventId) return; + const auto marker = findInTimeline(eventId); + if (!eventId.isEmpty() && marker == historyEdge()) + qCWarning(MESSAGES) + << eventId + << "is marked as last displayed but doesn't seem to be loaded"; + d->lastDisplayedEventId = eventId; emit lastDisplayedEventChanged(); } -- cgit v1.2.3