-
Notifications
You must be signed in to change notification settings - Fork 469
Open
Labels
A-InviteT-Taskgood first issueThis is a fix that might be an easy place for someone to start for their first contributionThis is a fix that might be an easy place for someone to start for their first contribution
Description
Spawning from #19321 (comment),
We have two functions which try to find the users who can invite:
Disparate implementations cause problems
Before #19321, for v12 rooms:
get_users_which_can_issue_invite(...)would indicate a local user was available.- But
get_user_which_could_invite(...)would find no eligible user due to flawed logic.
This mismatch caused #19120, resulting in a user-facing error. If we instead were working from the same source of truth, a flawed implementation would only result in falling back to the slower but successful remote join instead of the most correct local join.
synapse/synapse/handlers/room_member.py
Lines 1318 to 1341 in 6e80f2c
| allowed_servers = get_servers_from_users( | |
| get_users_which_can_issue_invite(current_state) | |
| ) | |
| # If the local server is not one of allowed servers, then a remote | |
| # join must be done. Return the list of prospective servers based on | |
| # which can issue invites. | |
| if self.hs.hostname not in allowed_servers: | |
| return True, list(allowed_servers) | |
| # Ensure the member should be allowed access via membership in a room. | |
| await self.event_auth_handler.check_restricted_join_rules( | |
| state_before_join, room_version, user_id, previous_membership | |
| ) | |
| # If this is going to be a local join, additional information must | |
| # be included in the event content in order to efficiently validate | |
| # the event. | |
| content[ | |
| EventContentFields.AUTHORISING_USER | |
| ] = await self.event_auth_handler.get_user_which_could_invite( | |
| room_id, | |
| state_before_join, | |
| ) |
Refactor
We should refactor get_user_which_could_invite(...) to use get_users_which_can_issue_invite(...) under the hood.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-InviteT-Taskgood first issueThis is a fix that might be an easy place for someone to start for their first contributionThis is a fix that might be an easy place for someone to start for their first contribution