fix: Disambiguate appservices in lazy loading context
In the previous commit, app services would all appear to be the same device when accessing the same user. This sets the device ID to be the appservice ID when available to avoid possible clobbering.
This commit is contained in:
parent
68d68a0645
commit
3a95585f0e
1 changed files with 15 additions and 2 deletions
|
@ -26,7 +26,10 @@ use ruma::{
|
|||
Direction,
|
||||
client::{filter::RoomEventFilter, message::get_message_events},
|
||||
},
|
||||
events::{AnyStateEvent, StateEventType, TimelineEventType, TimelineEventType::*},
|
||||
events::{
|
||||
AnyStateEvent, StateEventType,
|
||||
TimelineEventType::{self, *},
|
||||
},
|
||||
serde::Raw,
|
||||
};
|
||||
|
||||
|
@ -129,10 +132,20 @@ pub(crate) async fn get_message_events_route(
|
|||
.take(limit)
|
||||
.collect()
|
||||
.await;
|
||||
// let appservice_id = body.appservice_info.map(|appservice|
|
||||
// appservice.registration.id);
|
||||
|
||||
let lazy_loading_context = lazy_loading::Context {
|
||||
user_id: sender_user,
|
||||
device_id: sender_device.map_or_else(|| <&DeviceId>::from(""), AsRef::as_ref),
|
||||
device_id: match sender_device {
|
||||
| Some(device_id) => device_id,
|
||||
| None =>
|
||||
if let Some(registration) = body.appservice_info.as_ref() {
|
||||
<&DeviceId>::from(registration.registration.id.as_str())
|
||||
} else {
|
||||
<&DeviceId>::from("")
|
||||
},
|
||||
},
|
||||
room_id,
|
||||
token: Some(from.into_unsigned()),
|
||||
options: Some(&filter.lazy_load_options),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue