`RoomList` API: enable `account_data` extension by default

`RoomList` API: enable `account_data` extension by default
This commit is contained in:
Ivan Enderlin 2023-06-07 09:35:04 +02:00 committed by GitHub
commit a2cefedf73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -74,7 +74,7 @@ use matrix_sdk::{
SlidingSyncMode, SlidingSyncRoom,
};
use once_cell::sync::Lazy;
use ruma::{OwnedRoomId, RoomId};
use ruma::{api::client::sync::sync_events::v4::AccountDataConfig, assign, OwnedRoomId, RoomId};
use thiserror::Error;
use crate::{timeline::EventTimelineItem, Timeline};
@ -100,13 +100,17 @@ impl RoomList {
.map_err(Error::SlidingSync)?
.enable_caching()
.map_err(Error::SlidingSync)?
.add_cached_list(
// Enable the account data extension.
.with_account_data_extension(
assign! { AccountDataConfig::default(), { enabled: Some(true) }},
)
// TODO revert to `add_cached_list` when reloading rooms from the cache is blazingly
// fast
.add_list(
SlidingSyncList::builder(ALL_ROOMS_LIST_NAME)
.sync_mode(SlidingSyncMode::new_selective().add_range(0..=19))
.timeline_limit(1),
)
.await
.map_err(Error::SlidingSync)?
.build()
.await
.map_err(Error::SlidingSync)?;

View File

@ -252,6 +252,9 @@ async fn test_sync_from_init_to_enjoy() -> Result<(), Error> {
"to_device": {
"enabled": true,
},
"account_data": {
"enabled": true
}
},
},
respond with = {