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

Commit

Permalink
Use dedicated get_local_users_in_room to find local users when calc…
Browse files Browse the repository at this point in the history
…ulating `join_authorised_via_users_server` of a `/make_join` request (#13606)

Use dedicated `get_local_users_in_room` to find local users when calculating `join_authorised_via_users_server` ("the authorising user for joining a restricted room") of a `/make_join` request.

Found while working on #13575 (comment) but it's not related.
  • Loading branch information
MadLittleMods authored Aug 24, 2022
1 parent 371db86 commit c807b81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
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

0 comments on commit c807b81

Please sign in to comment.