Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Use dedicated get_local_users_in_room to find local users when calculating join_authorised_via_users_server of a /make_join request (get_users_in_room mis-use) #13606

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/13606.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use dedicated `get_local_users_in_room(room_id)` function to find local users when calculating `join_authorised_via_users_server` of a `/make_join` request.
9 changes: 3 additions & 6 deletions synapse/handlers/event_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,9 @@ async def get_user_which_could_invite(
else:
users = {}

# Find the user with the highest power level.
users_in_room = await self._store.get_users_in_room(room_id)
# Only interested in local users.
local_users_in_room = [
u for u in users_in_room if get_domain_from_id(u) == self._server_name
]
# Find the user with the highest power level (only interested in local
# users).
local_users_in_room = await self._store.get_local_users_in_room(room_id)
chosen_user = max(
local_users_in_room,
key=lambda user: users.get(user, users_default_level),
Expand Down