Ensure we have a 'membership' key in RoomMemberEvents

paul/schema_breaking_changes
Erik Johnston 2014-08-18 10:59:57 +01:00
parent bc2512fa95
commit 1a1e0384ef
1 changed files with 2 additions and 0 deletions

View File

@ -66,6 +66,8 @@ class RoomMemberEvent(SynapseEvent):
def __init__(self, **kwargs): def __init__(self, **kwargs):
if "target_user_id" in kwargs: if "target_user_id" in kwargs:
kwargs["state_key"] = kwargs["target_user_id"] kwargs["state_key"] = kwargs["target_user_id"]
if "membership" not in kwargs:
kwargs["membership"] = kwargs.get("content", {}).get("membership")
super(RoomMemberEvent, self).__init__(**kwargs) super(RoomMemberEvent, self).__init__(**kwargs)
def get_content_template(self): def get_content_template(self):