From fcbceee2fc8548751cf1c44999a5365849eaa17c Mon Sep 17 00:00:00 2001 From: Jason Robinson Date: Wed, 27 May 2026 16:25:51 +0300 Subject: [PATCH] Don't return anything for users without profiles in `_generate_initial_sync_entry_for_profile_updates` --- synapse/handlers/sync.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 32d8b569de..35dac31cce 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -2161,13 +2161,12 @@ class SyncHandler: all_updates: dict[str, dict[str, JsonValue | None]] = {} for other_user_id in user_ids: - displayname = None - avatar_url = None - custom_fields: JsonDict = {} - profile_data = profile_data_by_user.get(other_user_id) - if profile_data is not None: - displayname, avatar_url, custom_fields = profile_data + if profile_data is None: + # Don't generate anything for users with no profile data + continue + + displayname, avatar_url, custom_fields = profile_data per_user_updates: dict[str, JsonValue | None] = {} for field_name in profile_fields: