From 2a3e1dfcd716ec7248b82f659b3d7e76b33cd062 Mon Sep 17 00:00:00 2001 From: James Graham Date: Sun, 12 Nov 2023 16:32:08 +0000 Subject: [PATCH] Read Marker Hidden Only show the read marker if there is a non-hidden event earlier in the timeline fixes network/neochat#615 --- src/models/messageeventmodel.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/models/messageeventmodel.cpp b/src/models/messageeventmodel.cpp index 02ea3655f..95809fc71 100644 --- a/src/models/messageeventmodel.cpp +++ b/src/models/messageeventmodel.cpp @@ -437,6 +437,15 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const const KFormat format; return format.formatRelativeDateTime(eventDate, QLocale::ShortFormat); } + case SpecialMarksRole: + // Check if all the earlier events in the timeline are hidden. If so hide this. + for (auto r = row - 1; r >= 0; --r) { + const auto specialMark = index(r).data(SpecialMarksRole); + if (!(specialMark == EventStatus::Hidden || specialMark == EventStatus::Replaced)) { + return EventStatus::Normal; + } + } + return EventStatus::Hidden; } return {}; }