aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-07-28 03:33:24 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-07-28 03:57:21 +0200
commit4ef72d95868451b7e53bd49a873648332a121130 (patch)
tree3d478c270fc2c23b114551a564cff2b7c2460764
parentcddf3c6a2ab7481e5816ca7632b9f919efa0ac40 (diff)
downloadlibquotient-4ef72d95868451b7e53bd49a873648332a121130.tar.gz
libquotient-4ef72d95868451b7e53bd49a873648332a121130.zip
setFirst/LastDisplayedEvent(): warn about unloaded events
-rw-r--r--lib/room.cpp11
1 files changed, 11 insertions, 0 deletions
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();
}