summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-04-05 01:49:11 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2023-04-05 01:49:11 +0200
commit1a97a36dd23ee5bfdaee27a426217d09eca1b5d7 (patch)
tree023b0a50b5fcf3c8074f7aef30b86ad1fb508dde /src
parentFix switching between thread showing stale messages in some circumstances (diff)
downloadnheko-1a97a36dd23ee5bfdaee27a426217d09eca1b5d7.tar.xz
Try to reset unread marker if we fail to set it on the server
Diffstat (limited to 'src')
-rw-r--r--src/timeline/TimelineModel.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index e17c1c59..cb9fb7fa 100644
--- a/src/timeline/TimelineModel.cpp
+++ b/src/timeline/TimelineModel.cpp
@@ -1264,10 +1264,14 @@ TimelineModel::readEvent(const std::string &id)
     http::client()->read_event(
       room_id_.toStdString(),
       id,
-      [this](mtx::http::RequestErr err) {
+      [this, newId = id, oldId = currentReadId](mtx::http::RequestErr err) {
           if (err) {
-              nhlog::net()->warn(
-                "failed to read_event ({}, {})", room_id_.toStdString(), currentId.toStdString());
+              nhlog::net()->warn("failed to read_event ({}, {})", room_id_.toStdString(), newId);
+
+              ChatPage::instance()->callFunctionOnGuiThread([this, newId, oldId] {
+                  if (currentReadId.toStdString() == newId)
+                      this->currentReadId = oldId;
+              });
           }
       },
       !UserSettings::instance()->readReceipts());