diff options
author | Kegan Dougal <kegan@matrix.org> | 2014-08-26 10:37:31 +0100 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2014-08-26 10:37:31 +0100 |
commit | f6daa9f1703d0f924dc2c519151b841def4a051b (patch) | |
tree | feebb74986533487afe19e91f3e52437d3fd1fad /synapse/api/events/room.py | |
parent | Add 'state_key' to valid_keys (diff) | |
parent | URL renaming: Room state keys now use the format /rooms/$roomid/state/$event_... (diff) | |
download | synapse-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.py | 10 |
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", ] |