Fix missing rooms and wrong avatars in initialsync
This commit is contained in:
parent
fd8cf4ad8d
commit
6536f89507
|
@ -98,14 +98,16 @@ class MatrixClient(nio.AsyncClient):
|
||||||
}
|
}
|
||||||
|
|
||||||
limit_1_filter: ClassVar[Dict[str, Any]] = {
|
limit_1_filter: ClassVar[Dict[str, Any]] = {
|
||||||
"presence": {"limit": 1},
|
"presence": {"limit": 1},
|
||||||
"account_data": {"limit": 1},
|
|
||||||
|
|
||||||
"room": {
|
"room": {
|
||||||
"ephemeral": {"limit": 1},
|
"ephemeral": {"limit": 1},
|
||||||
"state": {"limit": 1},
|
"timeline": {
|
||||||
"timeline": {"limit": 1},
|
"limit": 1,
|
||||||
"account_data": {"limit": 1},
|
# This kind says another event was redacted, but we wouldn't
|
||||||
|
# have it in our model, so nothing would be shown
|
||||||
|
"not_types": ["m.room.redaction"],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,14 @@ class NioCallbacks:
|
||||||
# Response callbacks
|
# Response callbacks
|
||||||
|
|
||||||
async def onSyncResponse(self, resp: nio.SyncResponse) -> None:
|
async def onSyncResponse(self, resp: nio.SyncResponse) -> None:
|
||||||
|
room_model = self.client.models[self.client.user_id, "rooms"]
|
||||||
|
|
||||||
for room_id, info in resp.rooms.join.items():
|
for room_id, info in resp.rooms.join.items():
|
||||||
|
if room_id not in room_model:
|
||||||
|
# Just in case we don't get any events for that room that
|
||||||
|
# triggers other callbacks
|
||||||
|
await self.client.register_nio_room(self.client.rooms[room_id])
|
||||||
|
|
||||||
if room_id not in self.client.past_tokens:
|
if room_id not in self.client.past_tokens:
|
||||||
self.client.past_tokens[room_id] = info.timeline.prev_batch
|
self.client.past_tokens[room_id] = info.timeline.prev_batch
|
||||||
|
|
||||||
|
@ -165,6 +172,7 @@ class NioCallbacks:
|
||||||
event and
|
event and
|
||||||
(event.event_type is not nio.RedactedEvent or event.is_local_echo)
|
(event.event_type is not nio.RedactedEvent or event.is_local_echo)
|
||||||
):
|
):
|
||||||
|
await self.client.register_nio_room(room)
|
||||||
return
|
return
|
||||||
|
|
||||||
event.source.source["content"] = {}
|
event.source.source["content"] = {}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user