diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-01-16 13:54:38 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-01-16 13:54:56 +0100 |
commit | 42b08257ec8badea788a4b02e901b633edd63211 (patch) | |
tree | 3cb1b479d832f7df91574a8c5999e9df8d69742c | |
parent | Translated using Weblate (Italian) (diff) | |
download | nheko-42b08257ec8badea788a4b02e901b633edd63211.tar.xz |
Make read markers a bit less confusing
-rw-r--r-- | resources/qml/MessageView.qml | 4 | ||||
-rw-r--r-- | src/timeline/TimelineModel.cpp | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index 7799dbf7..e3222054 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -20,10 +20,10 @@ ListView { spacing: 4 verticalLayoutDirection: ListView.BottomToTop onCountChanged: { + // Mark timeline as read if (atYEnd) model.currentIndex = 0; - - } // Mark last event as read, since we are at the bottom + } ScrollHelper { flickable: parent 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<QString> &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)); |