From 42b08257ec8badea788a4b02e901b633edd63211 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sat, 16 Jan 2021 13:54:38 +0100 Subject: Make read markers a bit less confusing --- src/timeline/TimelineModel.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/timeline') diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index 852f584d..c6c084cc 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -728,12 +728,14 @@ TimelineModel::updateLastMessage() void TimelineModel::setCurrentIndex(int index) { + if (!ChatPage::instance()->isActiveWindow()) + return; + auto oldIndex = idToIndex(currentId); currentId = indexToId(index); emit currentIndexChanged(index); - if ((oldIndex > index || oldIndex == -1) && !currentId.startsWith("m") && - ChatPage::instance()->isActiveWindow()) { + if ((oldIndex > index || oldIndex == -1) && !currentId.startsWith("m")) { readEvent(currentId.toStdString()); } } @@ -896,7 +898,6 @@ TimelineModel::markEventsAsRead(const std::vector &event_ids) read.insert(id); int idx = idToIndex(id); if (idx < 0) { - nhlog::ui()->warn("Read index out of range"); return; } emit dataChanged(index(idx, 0), index(idx, 0)); -- cgit 1.5.1