diff options
author | Erik Johnston <erikj@jki.re> | 2017-01-10 14:04:54 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-10 14:04:54 +0000 |
commit | 7d0981b31298d93768f96106a5b2033ae5de65c1 (patch) | |
tree | 31594f5e23e035dbd5e22765dcc4b0f9ff64d13c /synapse/rest/client | |
parent | Merge pull request #1786 from matrix-org/erikj/linearizer_name (diff) | |
parent | Linearize updates to membership via PUT /state/ (diff) | |
download | synapse-7d0981b31298d93768f96106a5b2033ae5de65c1.tar.xz |
Merge pull request #1787 from matrix-org/erikj/linearize_member
Linearize updates to membership via PUT /state/
Diffstat (limited to 'synapse/rest/client')
-rw-r--r-- | synapse/rest/client/v1/room.py | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/synapse/rest/client/v1/room.py b/synapse/rest/client/v1/room.py index eead435bfd..2ebf5e59a0 100644 --- a/synapse/rest/client/v1/room.py +++ b/synapse/rest/client/v1/room.py @@ -152,23 +152,29 @@ class RoomStateEventRestServlet(ClientV1RestServlet): if state_key is not None: event_dict["state_key"] = state_key - msg_handler = self.handlers.message_handler - event, context = yield msg_handler.create_event( - event_dict, - token_id=requester.access_token_id, - txn_id=txn_id, - ) - if event_type == EventTypes.Member: - yield self.handlers.room_member_handler.send_membership_event( + membership = content.get("membership", None) + event = yield self.handlers.room_member_handler.update_membership( requester, - event, - context, + target=UserID.from_string(state_key), + room_id=room_id, + action=membership, + content=content, ) else: + msg_handler = self.handlers.message_handler + event, context = yield msg_handler.create_event( + event_dict, + token_id=requester.access_token_id, + txn_id=txn_id, + ) + yield msg_handler.send_nonmember_event(requester, event, context) - defer.returnValue((200, {"event_id": event.event_id})) + ret = {} + if event: + ret = {"event_id": event.event_id} + defer.returnValue((200, ret)) # TODO: Needs unit testing for generic events + feedback |