summary refs log tree commit diff
path: root/src/timeline
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-05-06 19:21:31 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-05-06 19:21:31 +0200
commita942ae9b93c1a8c8b55f46e340ecb592eb737957 (patch)
tree55fcb3775b5dfdadd1deee1764f6aafadba6d0a2 /src/timeline
parentFix joined rooms dropping to the bottom at first (diff)
downloadnheko-a942ae9b93c1a8c8b55f46e340ecb592eb737957.tar.xz
Fix messages being immediately read again
Diffstat (limited to 'src/timeline')
-rw-r--r--src/timeline/TimelineModel.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index 1c0abd17..df2051e6 100644
--- a/src/timeline/TimelineModel.cpp
+++ b/src/timeline/TimelineModel.cpp
@@ -321,16 +321,24 @@ TimelineModel::data(const QString &id, int role) const
         }
         case Id:
                 return id;
-        case State:
+        case State: {
+                auto containsOthers = [](const auto &vec) {
+                        for (const auto &e : vec)
+                                if (e.second != http::client()->user_id().to_string())
+                                        return true;
+                        return false;
+                };
+
                 // only show read receipts for messages not from us
                 if (acc::sender(event) != http::client()->user_id().to_string())
                         return qml_mtx_events::Empty;
                 else if (pending.contains(id))
                         return qml_mtx_events::Sent;
-                else if (read.contains(id) || cache::readReceipts(id, room_id_).size() > 1)
+                else if (read.contains(id) || containsOthers(cache::readReceipts(id, room_id_)))
                         return qml_mtx_events::Read;
                 else
                         return qml_mtx_events::Received;
+        }
         case IsEncrypted: {
                 return std::holds_alternative<
                   mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>(events[id]);