mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Fix bad timestamps being stored for room infos
This commit is contained in:
parent
7a29531739
commit
b6bbbdeae7
1 changed files with 4 additions and 1 deletions
|
@ -1815,7 +1815,7 @@ Cache::saveState(const mtx::responses::Sync &res)
|
||||||
if (!std::visit([](const auto &e) -> bool { return isMessage(e); }, e))
|
if (!std::visit([](const auto &e) -> bool { return isMessage(e); }, e))
|
||||||
continue;
|
continue;
|
||||||
updatedInfo.approximate_last_modification_ts =
|
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());
|
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.guest_access = j.at("guest_access").get<bool>();
|
||||||
|
|
||||||
info.approximate_last_modification_ts = j.value<uint64_t>("app_l_ts", 0);
|
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.notification_count = j.value("notification_count", 0);
|
||||||
info.highlight_count = j.value("highlight_count", 0);
|
info.highlight_count = j.value("highlight_count", 0);
|
||||||
|
|
Loading…
Reference in a new issue