summary refs log tree commit diff
path: root/src/Cache.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2022-06-28 23:18:26 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2022-06-28 23:18:36 +0200
commitb6bbbdeae7966761ad2de7cdad92363c6926cfb5 (patch)
treea10e3fc6be3e51fb25f00211febe54c66d0d8faf /src/Cache.cpp
parentFix blurriness of svg icons (#1108) (diff)
downloadnheko-b6bbbdeae7966761ad2de7cdad92363c6926cfb5.tar.xz
Fix bad timestamps being stored for room infos
Diffstat (limited to '')
-rw-r--r--src/Cache.cpp5
1 files changed, 4 insertions, 1 deletions
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<bool>();
 
     info.approximate_last_modification_ts = j.value<uint64_t>("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);