From 1b82b8242b1290b3ce39f932597e8cd3854b5e82 Mon Sep 17 00:00:00 2001
From: Nicolas Werner <nicolas.werner@hotmail.de>
Date: Sat, 11 Sep 2021 01:29:09 +0200
Subject: [PATCH] Keep identities for users cached

There is not really a reason to stop tracking them, just because the
server says so. We might still want to show a users profile, etc.
---
 src/Cache.cpp | 8 --------
 src/Cache_p.h | 3 ---
 2 files changed, 11 deletions(-)

diff --git a/src/Cache.cpp b/src/Cache.cpp
index d009c0d38..84e2ddc2a 100644
--- a/src/Cache.cpp
+++ b/src/Cache.cpp
@@ -1572,7 +1572,6 @@ Cache::saveState(const mtx::responses::Sync &res)
         savePresence(txn, res.presence);
 
         markUserKeysOutOfDate(txn, userKeyCacheDb, res.device_lists.changed, currentBatchToken);
-        deleteUserKeys(txn, userKeyCacheDb, res.device_lists.left);
 
         removeLeftRooms(txn, res.rooms.leave);
 
@@ -4124,13 +4123,6 @@ Cache::updateUserKeys(const std::string &sync_token, const mtx::responses::Query
         }
 }
 
-void
-Cache::deleteUserKeys(lmdb::txn &txn, lmdb::dbi &db, const std::vector<std::string> &user_ids)
-{
-        for (const auto &user_id : user_ids)
-                db.del(txn, user_id);
-}
-
 void
 Cache::markUserKeysOutOfDate(lmdb::txn &txn,
                              lmdb::dbi &db,
diff --git a/src/Cache_p.h b/src/Cache_p.h
index 6190413fb..7780c80f6 100644
--- a/src/Cache_p.h
+++ b/src/Cache_p.h
@@ -55,9 +55,6 @@ public:
                                    lmdb::dbi &db,
                                    const std::vector<std::string> &user_ids,
                                    const std::string &sync_token);
-        void deleteUserKeys(lmdb::txn &txn,
-                            lmdb::dbi &db,
-                            const std::vector<std::string> &user_ids);
         void query_keys(const std::string &user_id,
                         std::function<void(const UserKeyCache &, mtx::http::RequestErr)> cb);
 
-- 
GitLab