summary refs log tree commit diff
path: root/synapse/api/events/room.py
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-08-26 10:37:31 +0100
committerKegan Dougal <kegan@matrix.org>2014-08-26 10:37:31 +0100
commitf6daa9f1703d0f924dc2c519151b841def4a051b (patch)
treefeebb74986533487afe19e91f3e52437d3fd1fad /synapse/api/events/room.py
parentAdd 'state_key' to valid_keys (diff)
parentURL renaming: Room state keys now use the format /rooms/$roomid/state/$event_... (diff)
downloadsynapse-f6daa9f1703d0f924dc2c519151b841def4a051b.tar.xz
Merge branch 'client_server_url_rename' into develop
Diffstat (limited to 'synapse/api/events/room.py')
-rw-r--r--synapse/api/events/room.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/api/events/room.py b/synapse/api/events/room.py
index 42459f3f21..2a7b5e8aba 100644
--- a/synapse/api/events/room.py
+++ b/synapse/api/events/room.py
@@ -13,6 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from synapse.api.constants import Membership
+from synapse.api.errors import SynapseError
 from . import SynapseEvent
 
 
@@ -59,15 +61,15 @@ class RoomMemberEvent(SynapseEvent):
     TYPE = "m.room.member"
 
     valid_keys = SynapseEvent.valid_keys + [
-        "target_user_id",  # target
+        # target is the state_key
         "membership",  # action
     ]
 
     def __init__(self, **kwargs):
-        if "target_user_id" in kwargs:
-            kwargs["state_key"] = kwargs["target_user_id"]
         if "membership" not in kwargs:
             kwargs["membership"] = kwargs.get("content", {}).get("membership")
+        if not kwargs["membership"] in Membership.LIST:
+            raise SynapseError(400, "Bad membership value.")
         super(RoomMemberEvent, self).__init__(**kwargs)
 
     def get_content_template(self):
@@ -108,7 +110,7 @@ class InviteJoinEvent(SynapseEvent):
     TYPE = "m.room.invite_join"
 
     valid_keys = SynapseEvent.valid_keys + [
-        "target_user_id",
+        # target_user_id is the state_key
         "target_host",
     ]