1 files changed, 4 insertions, 3 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index 97c9f01245..6d680b0795 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -1939,9 +1939,10 @@ class RoomShutdownHandler:
else:
logger.info("Shutting down room %r", room_id)
- users = await self.store.get_users_in_room(room_id)
- for user_id in users:
- if not self.hs.is_mine_id(user_id):
+ users = await self.store.get_local_users_related_to_room(room_id)
+ for user_id, membership in users:
+ # If the user is not in the room (or is banned), nothing to do.
+ if membership not in (Membership.JOIN, Membership.INVITE, Membership.KNOCK):
continue
logger.info("Kicking %r from %r...", user_id, room_id)
|