Ruma upgrade
This commit is contained in:
parent
17ad5f0595
commit
2808dd2000
45 changed files with 528 additions and 474 deletions
|
@ -1,3 +1,4 @@
|
|||
use ruma::events::ToDeviceEventType;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use crate::{database::DatabaseGuard, Error, Result, Ruma};
|
||||
|
@ -15,7 +16,7 @@ use ruma::{
|
|||
/// Send a to-device event to a set of client devices.
|
||||
pub async fn send_event_to_device_route(
|
||||
db: DatabaseGuard,
|
||||
body: Ruma<send_event_to_device::v3::Request<'_>>,
|
||||
body: Ruma<send_event_to_device::v3::IncomingRequest>,
|
||||
) -> Result<send_event_to_device::v3::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
let sender_device = body.sender_device.as_deref();
|
||||
|
@ -45,8 +46,8 @@ pub async fn send_event_to_device_route(
|
|||
serde_json::to_vec(&federation::transactions::edu::Edu::DirectToDevice(
|
||||
DirectDeviceContent {
|
||||
sender: sender_user.clone(),
|
||||
ev_type: EventType::from(&*body.event_type),
|
||||
message_id: body.txn_id.clone(),
|
||||
ev_type: ToDeviceEventType::from(&*body.event_type),
|
||||
message_id: body.txn_id.to_owned(),
|
||||
messages,
|
||||
},
|
||||
))
|
||||
|
@ -61,7 +62,7 @@ pub async fn send_event_to_device_route(
|
|||
DeviceIdOrAllDevices::DeviceId(target_device_id) => db.users.add_to_device_event(
|
||||
sender_user,
|
||||
target_user_id,
|
||||
target_device_id,
|
||||
&target_device_id,
|
||||
&body.event_type,
|
||||
event.deserialize_as().map_err(|_| {
|
||||
Error::BadRequest(ErrorKind::InvalidParam, "Event is invalid")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue