mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-20 02:44:11 -04:00
Refactor the membership check methods in Auth
these were getting a bit unwieldy, so let's combine `check_joined_room` and `check_user_was_in_room` into a single `check_user_in_room`.
This commit is contained in:
parent
adfaea8c69
commit
b58d17e44f
4 changed files with 46 additions and 73 deletions
|
@ -122,11 +122,11 @@ class TypingNotificationsTestCase(unittest.HomeserverTestCase):
|
|||
|
||||
self.room_members = []
|
||||
|
||||
def check_joined_room(room_id, user_id):
|
||||
def check_user_in_room(room_id, user_id):
|
||||
if user_id not in [u.to_string() for u in self.room_members]:
|
||||
raise AuthError(401, "User is not in the room")
|
||||
|
||||
hs.get_auth().check_joined_room = check_joined_room
|
||||
hs.get_auth().check_user_in_room = check_user_in_room
|
||||
|
||||
def get_joined_hosts_for_room(room_id):
|
||||
return set(member.domain for member in self.room_members)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue