Fix membership parsing.
The spec requires the membership status to be inside of the content, even though sometimes it's outside of it as well.
This commit is contained in:
parent
0f08584744
commit
97dbda95a7
1 changed files with 3 additions and 3 deletions
|
@ -121,14 +121,14 @@ class RoomInfo():
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _membership_from_dict(event_dict):
|
def _membership_from_dict(event_dict):
|
||||||
if (event_dict["membership"] not in [
|
if (event_dict["content"]["membership"] not in [
|
||||||
"invite", "join", "knock", "leave", "ban"
|
"invite", "join", "knock", "leave", "ban"
|
||||||
]):
|
]):
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
if event_dict["membership"] == "join":
|
if event_dict["content"]["membership"] == "join":
|
||||||
return RoomMemberJoin.from_dict(event_dict)
|
return RoomMemberJoin.from_dict(event_dict)
|
||||||
elif event_dict["membership"] == "leave":
|
elif event_dict["content"]["membership"] == "leave":
|
||||||
return RoomMemberLeave.from_dict(event_dict)
|
return RoomMemberLeave.from_dict(event_dict)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Add table
Reference in a new issue