Support optional device_id's in lazy-loading context.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-04-28 01:32:13 +00:00
parent ea42606b4b
commit 0f7c1543ce
4 changed files with 5 additions and 5 deletions

View File

@@ -113,7 +113,7 @@ pub(crate) async fn get_context_route(
let lazy_loading_context = lazy_loading::Context {
user_id: sender_user,
device_id: sender_device,
device_id: Some(sender_device),
room_id,
token: Some(base_count.into_unsigned()),
options: Some(&filter.lazy_load_options),

View File

@@ -132,7 +132,7 @@ pub(crate) async fn get_message_events_route(
let lazy_loading_context = lazy_loading::Context {
user_id: sender_user,
device_id: sender_device,
device_id: Some(sender_device),
room_id,
token: Some(from.into_unsigned()),
options: Some(&filter.lazy_load_options),

View File

@@ -651,7 +651,7 @@ async fn load_joined_room(
let lazy_loading_context = &lazy_loading::Context {
user_id: sender_user,
device_id: sender_device,
device_id: Some(sender_device),
room_id,
token: Some(since),
options: Some(&filter.room.state.lazy_load_options),

View File

@@ -27,7 +27,7 @@ pub trait Options: Send + Sync {
#[derive(Clone, Debug)]
pub struct Context<'a> {
pub user_id: &'a UserId,
pub device_id: &'a DeviceId,
pub device_id: Option<&'a DeviceId>,
pub room_id: &'a RoomId,
pub token: Option<u64>,
pub options: Option<&'a LazyLoadOptions>,
@@ -40,7 +40,7 @@ pub enum Status {
}
pub type Witness = HashSet<OwnedUserId>;
type Key<'a> = (&'a UserId, &'a DeviceId, &'a RoomId, &'a UserId);
type Key<'a> = (&'a UserId, Option<&'a DeviceId>, &'a RoomId, &'a UserId);
impl crate::Service for Service {
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {