From f31d9fb983e7f83e56ee777d3ef72da2c6288ce2 Mon Sep 17 00:00:00 2001 From: Jason Robinson Date: Wed, 15 Jul 2026 23:13:01 +0300 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Olivier 'reivilibre' --- rust/src/events/internal_metadata.rs | 2 +- synapse/handlers/profile.py | 14 +++++++------- synapse/replication/tcp/client.py | 2 +- synapse/replication/tcp/streams/_base.py | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rust/src/events/internal_metadata.rs b/rust/src/events/internal_metadata.rs index 94c13b485f..1c27e8caca 100644 --- a/rust/src/events/internal_metadata.rs +++ b/rust/src/events/internal_metadata.rs @@ -585,7 +585,7 @@ impl EventInternalMetadata { } /// For membership events, this will contain a list of users who - /// would be interested in the users profile updates, triggered + /// would be interested in the user's profile updates, triggered /// by the membership change. pub fn membership_update_users_in_shared_rooms(&self) -> PyResult>> { Ok(self diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py index 4c316d61a2..e9f7340e7f 100644 --- a/synapse/handlers/profile.py +++ b/synapse/handlers/profile.py @@ -271,13 +271,13 @@ class ProfileHandler: target_user: the user whose displayname is to be changed. requester: The user attempting to make this change. new_displayname: The displayname to give this user. - profile_update_target_user_ids: User id's to trigger profile updates stream + profile_update_target_user_ids: User IDs to trigger profile updates stream updates for. by_admin: Whether this change was made by an administrator. propagate: Whether this change also applies to the user's membership events. Returns: - Stream ID of the profile updates stream that was just inserted. + Stream ID of the profile updates stream row that was just inserted. """ if not self.hs.is_mine(target_user): raise SynapseError(400, "User is not hosted on this homeserver") @@ -397,13 +397,13 @@ class ProfileHandler: target_user: the user whose avatar URL is to be changed. requester: The user attempting to make this change. new_avatar_url: The avatar URL to give this user. - profile_update_target_user_ids: User ID's to trigger profile update stream + profile_update_target_user_ids: User IDs to trigger profile update stream updates for. by_admin: Whether this change was made by an administrator. propagate: Whether this change also applies to the user's membership events. Returns: - Stream ID of the profile updates stream that was just inserted. + Stream ID of the profile updates stream row that was just inserted. """ if not self.hs.is_mine(target_user): raise SynapseError(400, "User is not hosted on this homeserver") @@ -475,7 +475,7 @@ class ProfileHandler: if we're an events stream writer. Args: - target_user: User ID who'se profile is being deactivated. + target_user: User ID whose profile is being deactivated. requester: The requesting user. by_admin: Whether the action is being done by an admin. """ @@ -552,7 +552,7 @@ class ProfileHandler: field_names=profile_updates, target_users=profile_update_targets["users"], ) - if stream_id and profile_update_targets["rooms"]: + if stream_id is not None and profile_update_targets["rooms"]: self._notifier.on_new_event( StreamKeyType.PROFILE_UPDATES, stream_id, @@ -774,7 +774,7 @@ class ProfileHandler: profile_update_target_user_ids=profile_update_targets["users"], ) - if stream_id and profile_update_targets["rooms"]: + if stream_id is not None and profile_update_targets["rooms"]: self._notifier.on_new_event( StreamKeyType.PROFILE_UPDATES, stream_id, diff --git a/synapse/replication/tcp/client.py b/synapse/replication/tcp/client.py index 00a24db749..f4161726ad 100644 --- a/synapse/replication/tcp/client.py +++ b/synapse/replication/tcp/client.py @@ -273,7 +273,7 @@ class ReplicationDataHandler: # Get all the rooms of the updated users, dict of # User ID -> [Room ID] users_and_rooms = await self.store.get_rooms_for_users(updated_user_ids) - # Loop through each users room ID's and add to our set of rooms + # Loop through each user's room IDs and add to our set of rooms for user_room_ids in users_and_rooms.values(): room_ids.update(user_room_ids) diff --git a/synapse/replication/tcp/streams/_base.py b/synapse/replication/tcp/streams/_base.py index 86242b2341..c41fc33127 100644 --- a/synapse/replication/tcp/streams/_base.py +++ b/synapse/replication/tcp/streams/_base.py @@ -778,7 +778,7 @@ class ProfileUpdatesStreamRow: """ field_name: str | None """The profile field that was updated, see https://spec.matrix.org/unstable/client-server-api/#profiles. - This can be None if `action` is not 'update'. + This is None if `action` is not 'update'. """