base: Only update the tracked users when we're done with the state and timeline.

master
Damir Jelić 2020-07-07 15:48:28 +02:00
parent f33298b1a6
commit 98d36d0ef0
1 changed files with 15 additions and 15 deletions

View File

@ -990,21 +990,6 @@ impl BaseClient {
self.get_or_create_joined_room(&room_id).await?.clone()
};
#[cfg(feature = "encryption")]
{
let mut olm = self.olm.lock().await;
if let Some(o) = &mut *olm {
let room = matrix_room.read().await;
// If the room is encrypted, update the tracked users.
if room.is_encrypted() {
o.update_tracked_users(room.joined_members.keys()).await;
o.update_tracked_users(room.invited_members.keys()).await;
}
}
}
// RoomSummary contains information for calculating room name.
matrix_room
.write()
@ -1042,6 +1027,21 @@ impl BaseClient {
}
}
#[cfg(feature = "encryption")]
{
let mut olm = self.olm.lock().await;
if let Some(o) = &mut *olm {
let room = matrix_room.read().await;
// If the room is encrypted, update the tracked users.
if room.is_encrypted() {
o.update_tracked_users(room.joined_members.keys()).await;
o.update_tracked_users(room.invited_members.keys()).await;
}
}
}
// look at AccountData to further cut down users by collecting ignored users
if let Some(account_data) = &joined_room.account_data {
for account_data in &account_data.events {