Easy refactors of the user directory (#10789)

No functional changes here. This came out as I was working to tackle #5677
This commit is contained in:
David Robertson 2021-09-10 10:54:38 +01:00 committed by GitHub
parent c6f5fb5477
commit 318162f5de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 90 additions and 37 deletions

View file

@ -196,7 +196,6 @@ class UserDirectoryBackgroundUpdateStore(StateDeltasStore):
)
users_with_profile = await self.get_users_in_room_with_profiles(room_id)
user_ids = set(users_with_profile)
# Update each user in the user directory.
for user_id, profile in users_with_profile.items():
@ -207,7 +206,7 @@ class UserDirectoryBackgroundUpdateStore(StateDeltasStore):
to_insert = set()
if is_public:
for user_id in user_ids:
for user_id in users_with_profile:
if self.get_if_app_services_interested_in_user(user_id):
continue
@ -217,14 +216,14 @@ class UserDirectoryBackgroundUpdateStore(StateDeltasStore):
await self.add_users_in_public_rooms(room_id, to_insert)
to_insert.clear()
else:
for user_id in user_ids:
for user_id in users_with_profile:
if not self.hs.is_mine_id(user_id):
continue
if self.get_if_app_services_interested_in_user(user_id):
continue
for other_user_id in user_ids:
for other_user_id in users_with_profile:
if user_id == other_user_id:
continue