summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorDaniel Wagner-Hall <daniel@matrix.org>2016-02-15 16:16:03 +0000
committerDaniel Wagner-Hall <daniel@matrix.org>2016-02-15 16:16:03 +0000
commit150fcde0dce02670c2180f9d4657783eb204daa8 (patch)
tree6f3f6b12bc31ba3c69428e3e57d19ba6e2f4dc78 /synapse/handlers
parentInline _do_local_membership_update (diff)
downloadsynapse-150fcde0dce02670c2180f9d4657783eb204daa8.tar.xz
Reuse update_membership from /join
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/room.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index d17e5c1b7b..04916d4e24 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -403,7 +403,9 @@ class RoomMemberHandler(BaseHandler):
                     remotedomains.add(member.domain)
 
     @defer.inlineCallbacks
-    def update_membership(self, requester, target, room_id, action, txn_id=None):
+    def update_membership(
+            self, requester, target, room_id, action, txn_id=None, room_hosts=None
+    ):
         effective_membership_state = action
         if action in ["kick", "unban"]:
             effective_membership_state = "leave"
@@ -412,7 +414,7 @@ class RoomMemberHandler(BaseHandler):
 
         msg_handler = self.hs.get_handlers().message_handler
 
-        content = {"membership": unicode(effective_membership_state)}
+        content = {"membership": effective_membership_state}
         if requester.is_guest:
             content["kind"] = "guest"
 
@@ -423,6 +425,9 @@ class RoomMemberHandler(BaseHandler):
                 "room_id": room_id,
                 "sender": requester.user.to_string(),
                 "state_key": target.to_string(),
+
+                # For backwards compatibility:
+                "membership": effective_membership_state,
             },
             token_id=requester.access_token_id,
             txn_id=txn_id,
@@ -447,7 +452,8 @@ class RoomMemberHandler(BaseHandler):
             event,
             context,
             ratelimit=True,
-            is_guest=requester.is_guest
+            is_guest=requester.is_guest,
+            room_hosts=room_hosts,
         )
 
         if action == "forget":