From 3b7f1df38cc571b29b2e69864676a41c373156e3 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Thu, 29 Sep 2022 17:51:06 -0500 Subject: [PATCH 1/2] Fix `get_users_in_room` mis-use in `transfer_room_state_on_room_upgrade` Spawning from looking into `get_users_in_room` while investigating https://github.com/matrix-org/synapse/issues/13942#issuecomment-1262787050. See https://github.com/matrix-org/synapse/pull/13575#discussion_r953023755 for the original exploration around finding `get_users_in_room` mis-uses. --- synapse/handlers/room_member.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py index 88158822e009..ee669eb30f05 100644 --- a/synapse/handlers/room_member.py +++ b/synapse/handlers/room_member.py @@ -1150,8 +1150,8 @@ async def transfer_room_state_on_room_upgrade( logger.info("Transferring room state from %s to %s", old_room_id, room_id) # Find all local users that were in the old room and copy over each user's state - users = await self.store.get_users_in_room(old_room_id) - await self.copy_user_state_on_room_upgrade(old_room_id, room_id, users) + local_users = await self.store.get_local_users_in_room(old_room_id) + await self.copy_user_state_on_room_upgrade(old_room_id, room_id, local_users) # Add new room to the room directory if the old room was there # Remove old room from the room directory From b28e165b1d4541d58bd835887c9c98cea4a51236 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Thu, 29 Sep 2022 18:03:23 -0500 Subject: [PATCH 2/2] Add changelog --- changelog.d/13960.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/13960.misc diff --git a/changelog.d/13960.misc b/changelog.d/13960.misc new file mode 100644 index 000000000000..a7ba532bcb4e --- /dev/null +++ b/changelog.d/13960.misc @@ -0,0 +1 @@ +Use dedicated `get_local_users_in_room(room_id)` function to find local users when calculating users to copy over during a room upgrade.