diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-04-05 01:49:11 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-04-05 01:49:11 +0200 |
commit | 1a97a36dd23ee5bfdaee27a426217d09eca1b5d7 (patch) | |
tree | 023b0a50b5fcf3c8074f7aef30b86ad1fb508dde | |
parent | Fix switching between thread showing stale messages in some circumstances (diff) | |
download | nheko-1a97a36dd23ee5bfdaee27a426217d09eca1b5d7.tar.xz |
Try to reset unread marker if we fail to set it on the server
-rw-r--r-- | src/timeline/TimelineModel.cpp | 10 |
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()); |