From 4cf5e098a5266b663937fa3234f27967c56fac8b Mon Sep 17 00:00:00 2001 From: Jason Robinson Date: Mon, 1 Jun 2026 12:22:51 +0300 Subject: [PATCH] Clarify `_generate_initial_sync_entry_for_profile_updates` is for local users only currently --- synapse/handlers/sync.py | 5 +---- synapse/storage/databases/main/profile.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 86e48a4f94..dc786f05da 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -2142,10 +2142,7 @@ class SyncHandler: Build an initial sync entry for profile updates and attach it to the given `sync_result_builder`. - Note: Only the profile information for local users is returned. This is - to prevent fetching *too* many profiles in one request. Clients should - ideally instead first fetch profiles on-demand, then track updates for - all users via incremental `/sync`. + Note: Currently, only profile updates of local users are generated. Args: user_id: The Matrix ID of the user to generate the sync entry for. diff --git a/synapse/storage/databases/main/profile.py b/synapse/storage/databases/main/profile.py index 4e9c2e4f01..e70443fa77 100644 --- a/synapse/storage/databases/main/profile.py +++ b/synapse/storage/databases/main/profile.py @@ -431,7 +431,17 @@ class ProfileWorkerStore(SQLBaseStore): async def get_profile_data_for_users( self, user_ids: Collection[str] ) -> dict[str, dict[str, str | JsonDict | None]]: - """Fetch displayname/avatar_url/custom fields for a list of users.""" + """Fetch displayname/avatar_url/custom fields for a list of users. + + Currently, this returns only local users as the `profiles` table only + tracks local users. + + Args: + user_ids: List of user IDs to filter against. + + Returns: + Dictionary of displayname/avatar_url/custom fields for a list of users. + """ if not user_ids: return {}