Fix past member events affecting actual room state
This commit is contained in:
parent
7719df0135
commit
42b62377ab
|
@ -355,9 +355,11 @@ class NioCallbacks:
|
||||||
|
|
||||||
|
|
||||||
async def onRoomMemberEvent(self, room, ev) -> None:
|
async def onRoomMemberEvent(self, room, ev) -> None:
|
||||||
if ev.membership in ("invite", "join") and ev.state_key in room.users:
|
# The event can be a past event, don't trust it to update the model
|
||||||
|
# room's current state.
|
||||||
|
if ev.state_key in room.users:
|
||||||
await self.client.add_member(room, user_id=ev.state_key)
|
await self.client.add_member(room, user_id=ev.state_key)
|
||||||
elif ev.membership in ("left", "ban"):
|
else:
|
||||||
await self.client.remove_member(room, user_id=ev.state_key)
|
await self.client.remove_member(room, user_id=ev.state_key)
|
||||||
|
|
||||||
type_and_content = await self.process_room_member_event(room, ev)
|
type_and_content = await self.process_room_member_event(room, ev)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user