sdk-base: use updated account data for processing direct rooms

This commit is contained in:
Jorge Martín
2024-09-13 14:33:43 +02:00
committed by Jorge Martin Espinosa
parent a9ed62284e
commit dd13fe6b4e
2 changed files with 16 additions and 5 deletions

View File

@@ -1169,7 +1169,12 @@ impl BaseClient {
// because we want to have the push rules in place before we process
// rooms and their events, but we want to create the rooms before we
// process the `m.direct` account data event.
self.handle_account_data(&response.account_data.events, &mut changes).await;
if let Ok(Some(direct_account_data)) =
self.store.get_account_data_event(GlobalAccountDataEventType::Direct).await
{
debug!("Found direct room data in the Store, applying it");
self.handle_account_data(&vec![direct_account_data], &mut changes).await;
}
changes.presence = response
.presence

View File

@@ -26,11 +26,14 @@ use matrix_sdk_common::deserialized_responses::SyncTimelineEvent;
use ruma::events::AnyToDeviceEvent;
use ruma::{
api::client::sync::sync_events::v3::{self, InvitedRoom},
events::{AnyRoomAccountDataEvent, AnySyncStateEvent, AnySyncTimelineEvent},
events::{
AnyRoomAccountDataEvent, AnySyncStateEvent, AnySyncTimelineEvent,
GlobalAccountDataEventType,
},
serde::Raw,
JsOption, OwnedRoomId, RoomId, UInt,
};
use tracing::{debug, error, instrument, trace, warn};
use tracing::{debug, error, info, instrument, trace, warn};
use super::BaseClient;
#[cfg(feature = "e2e-encryption")]
@@ -303,8 +306,11 @@ impl BaseClient {
// because we want to have the push rules in place before we process
// rooms and their events, but we want to create the rooms before we
// process the `m.direct` account data event.
if !account_data.is_empty() {
self.handle_account_data(&account_data.global, &mut changes).await;
if let Ok(Some(direct_account_data)) =
self.store.get_account_data_event(GlobalAccountDataEventType::Direct).await
{
debug!("Found direct room data in the Store, applying it");
self.handle_account_data(&vec![direct_account_data], &mut changes).await;
}
// FIXME not yet supported by sliding sync.