From 1a97a36dd23ee5bfdaee27a426217d09eca1b5d7 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 5 Apr 2023 01:49:11 +0200 Subject: Try to reset unread marker if we fail to set it on the server --- src/timeline/TimelineModel.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') 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()); -- cgit 1.4.1