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 09:26:07 +0100
committerKegan Dougal <kegan@matrix.org>2014-08-26 09:26:07 +0100
commitcab3095803db0c046f414959d12e3549505f54c4 (patch)
treea00409373497d934a2f4bbc488f5eef3d5421420 /synapse/api/events/room.py
parentImpl: /rooms/roomid/state/eventtype/state_key - Renamed RoomTopicRestServlet ... (diff)
downloadsynapse-cab3095803db0c046f414959d12e3549505f54c4.tar.xz
Removed member list servlet: now using generic state paths.
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",
     ]