diff options
author | Erik Johnston <erikj@jki.re> | 2017-09-27 16:42:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-27 16:42:23 +0100 |
commit | 3a743f649c548df1df05a5b93ba1f57c7587eff6 (patch) | |
tree | bd8a82c2190f9d632944e071c9b51ce005926696 /synapse/rest/client/v1/room.py | |
parent | Merge pull request #2474 from matrix-org/dbkr/spam_check_module (diff) | |
parent | Fix bug where /joined_members didn't check user was in room (diff) | |
download | synapse-3a743f649c548df1df05a5b93ba1f57c7587eff6.tar.xz |
Merge pull request #2475 from matrix-org/erikj/joined_members_auth
Fix bug where /joined_members didn't check user was in room
Diffstat (limited to 'synapse/rest/client/v1/room.py')
-rw-r--r-- | synapse/rest/client/v1/room.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/synapse/rest/client/v1/room.py b/synapse/rest/client/v1/room.py index cd388770c8..4be0fee38d 100644 --- a/synapse/rest/client/v1/room.py +++ b/synapse/rest/client/v1/room.py @@ -398,22 +398,19 @@ class JoinedRoomMemberListRestServlet(ClientV1RestServlet): def __init__(self, hs): super(JoinedRoomMemberListRestServlet, self).__init__(hs) - self.state = hs.get_state_handler() + self.message_handler = hs.get_handlers().message_handler @defer.inlineCallbacks def on_GET(self, request, room_id): - yield self.auth.get_user_by_req(request) + requester = yield self.auth.get_user_by_req(request) + user_id = requester.user.to_string() - users_with_profile = yield self.state.get_current_user_in_room(room_id) + users_with_profile = yield self.message_handler.get_joined_members( + user_id, room_id, + ) defer.returnValue((200, { - "joined": { - user_id: { - "avatar_url": profile.avatar_url, - "display_name": profile.display_name, - } - for user_id, profile in users_with_profile.iteritems() - } + "joined": users_with_profile, })) |