From b6bbbdeae7966761ad2de7cdad92363c6926cfb5 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 28 Jun 2022 23:18:26 +0200 Subject: [PATCH] Fix bad timestamps being stored for room infos --- src/Cache.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Cache.cpp b/src/Cache.cpp index 2be2ef02..67889543 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -1815,7 +1815,7 @@ Cache::saveState(const mtx::responses::Sync &res) if (!std::visit([](const auto &e) -> bool { return isMessage(e); }, e)) continue; updatedInfo.approximate_last_modification_ts = - std::visit([](const auto &e) -> bool { return e.origin_server_ts; }, e); + std::visit([](const auto &e) -> uint64_t { return e.origin_server_ts; }, e); } roomsDb_.put(txn, room.first, nlohmann::json(updatedInfo).dump()); @@ -4850,6 +4850,9 @@ from_json(const nlohmann::json &j, RoomInfo &info) info.guest_access = j.at("guest_access").get(); info.approximate_last_modification_ts = j.value("app_l_ts", 0); + // workaround for bad values being stored in the past + if (info.approximate_last_modification_ts < 100000000000) + info.approximate_last_modification_ts = 0; info.notification_count = j.value("notification_count", 0); info.highlight_count = j.value("highlight_count", 0);