mirror of
https://github.com/element-hq/synapse.git
synced 2026-06-04 12:31:23 +00:00
Restrict initial sync profiles to local users for now
We don't have federated profile updates (yet), so use a cheaper database call to fetch only local users for the initial sync. This mirrors incremental sync as currently there are only local profiles being pushed into the profile updates stream table.
This commit is contained in:
@@ -2149,8 +2149,8 @@ class SyncHandler:
|
||||
sync_result_builder:
|
||||
profile_fields: The list of field IDs to filter for.
|
||||
"""
|
||||
user_ids = await self.store.get_users_who_share_room_with_user(user_id)
|
||||
user_ids = {u for u in user_ids if self._is_mine_id(u)}
|
||||
# Currently, limited to only local profiles, so filter remote servers out
|
||||
user_ids = await self.store.get_local_users_who_share_room_with_user(user_id)
|
||||
if not user_ids:
|
||||
return
|
||||
|
||||
|
||||
@@ -982,6 +982,17 @@ class RoomMemberWorkerStore(EventsWorkerStore, CacheInvalidationWorkerStore):
|
||||
|
||||
return user_who_share_room
|
||||
|
||||
async def get_local_users_who_share_room_with_user(self, user_id: str) -> set[str]:
|
||||
"""Returns the set of local users who share a room with `user_id`"""
|
||||
room_ids = await self.get_rooms_for_user(user_id)
|
||||
|
||||
user_who_share_room: set[str] = set()
|
||||
for room_id in room_ids:
|
||||
user_ids = await self.get_local_users_in_room(room_id)
|
||||
user_who_share_room.update(user_ids)
|
||||
|
||||
return user_who_share_room
|
||||
|
||||
@cached(cache_context=True, iterable=True)
|
||||
async def get_mutual_rooms_between_users(
|
||||
self, user_ids: frozenset[str], cache_context: _CacheContext
|
||||
|
||||
Reference in New Issue
Block a user