summary refs log tree commit diff
path: root/src/encryption/SelfVerificationStatus.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-11-07 03:38:48 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-11-07 03:52:57 +0100
commit5ca1fb18bbf9789a65eaf3113ee1ff65449ff086 (patch)
tree83885596d4b830ed5e6da2f2e36bc17048881fa4 /src/encryption/SelfVerificationStatus.cpp
parentFix crash when clearing empty timeline (diff)
downloadnheko-5ca1fb18bbf9789a65eaf3113ee1ff65449ff086.tar.xz
Move away from using an event loop to access secrets
Fixes messages in room flickering and being stuck

fixes #760
relates to #770
relates to #789
Diffstat (limited to 'src/encryption/SelfVerificationStatus.cpp')
-rw-r--r--src/encryption/SelfVerificationStatus.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/encryption/SelfVerificationStatus.cpp b/src/encryption/SelfVerificationStatus.cpp

index bbfb6f9c..32386fdb 100644 --- a/src/encryption/SelfVerificationStatus.cpp +++ b/src/encryption/SelfVerificationStatus.cpp
@@ -259,15 +259,20 @@ SelfVerificationStatus::invalidate() using namespace mtx::secret_storage; nhlog::db()->info("Invalidating self verification status"); + if (cache::isInitialized()) { + return; + } + this->hasSSSS_ = false; emit hasSSSSChanged(); auto keys = cache::client()->userKeys(http::client()->user_id().to_string()); if (!keys || keys->device_keys.find(http::client()->device_id()) == keys->device_keys.end()) { - cache::client()->markUserKeysOutOfDate({http::client()->user_id().to_string()}); - cache::client()->query_keys(http::client()->user_id().to_string(), - [](const UserKeyCache &, mtx::http::RequestErr) {}); - return; + QTimer::singleShot(500, [] { + cache::client()->markUserKeysOutOfDate({http::client()->user_id().to_string()}); + cache::client()->query_keys(http::client()->user_id().to_string(), + [](const UserKeyCache &, mtx::http::RequestErr) {}); + }); } if (keys->master_keys.keys.empty()) {