Discard room members from outdated initial sync
Fix in cooperation with matrix-nio commit ffc42287c22a1179a9be7d4e47555693417f715d, see its description.
This commit is contained in:
parent
b83fd63769
commit
aba47ef26b
|
@ -1845,6 +1845,15 @@ class MatrixClient(nio.AsyncClient):
|
||||||
self.models[self.user_id, "rooms"][room.room_id] = room_item
|
self.models[self.user_id, "rooms"][room.room_id] = room_item
|
||||||
|
|
||||||
if not registered or force_register_members:
|
if not registered or force_register_members:
|
||||||
|
model = self.models[self.user_id, room.room_id, "members"]
|
||||||
|
|
||||||
|
# The members we initially get from lazy sync may be outdated
|
||||||
|
# and contain members that already left.
|
||||||
|
# tuple() used to avoid "dict changed size during iteration".
|
||||||
|
for member_id in tuple(model):
|
||||||
|
if member_id not in room.users:
|
||||||
|
await self.remove_member(room, member_id)
|
||||||
|
|
||||||
for user_id in room.users:
|
for user_id in room.users:
|
||||||
await self.add_member(room, user_id)
|
await self.add_member(room, user_id)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user