From b32d88cd959ff6b7ba5da7fd2bbf0f18322d8941 Mon Sep 17 00:00:00 2001 From: miruka Date: Mon, 9 Dec 2019 14:36:03 -0400 Subject: [PATCH] Fix users that left a room not deleted from model --- src/python/matrix_client.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/python/matrix_client.py b/src/python/matrix_client.py index d33d5cbd..704b80ce 100644 --- a/src/python/matrix_client.py +++ b/src/python/matrix_client.py @@ -774,6 +774,16 @@ class MatrixClient(nio.AsyncClient): last_event = last_ev, ) + # List members that left the room, then remove them from our model + left_the_room = [ + user_id + for user_id in self.models[Member, room.room_id] + if user_id not in room.users + ] + + for user_id in left_the_room: + del self.models[Member, room.room_id][user_id] + # Add the room members to the added room new_dict = { user_id: Member(