mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 00:01:24 +01:00
don't automatically wrap in RumaResponse
This allows us to use the `ruma_route` convenience function even when we need to add our own hacks into the responses, thus making us less reliant on Ruma.
This commit is contained in:
parent
87ac0e2a38
commit
230ebd3884
35 changed files with 438 additions and 405 deletions
|
|
@ -8,14 +8,14 @@ use ruma::{
|
|||
to_device::DeviceIdOrAllDevices,
|
||||
};
|
||||
|
||||
use crate::{services, Error, Result, Ruma};
|
||||
use crate::{services, Error, Result, Ruma, RumaResponse};
|
||||
|
||||
/// # `PUT /_matrix/client/r0/sendToDevice/{eventType}/{txnId}`
|
||||
///
|
||||
/// Send a to-device event to a set of client devices.
|
||||
pub(crate) async fn send_event_to_device_route(
|
||||
body: Ruma<send_event_to_device::v3::Request>,
|
||||
) -> Result<send_event_to_device::v3::Response> {
|
||||
) -> Result<RumaResponse<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();
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ pub(crate) async fn send_event_to_device_route(
|
|||
.existing_txnid(sender_user, sender_device, &body.txn_id)?
|
||||
.is_some()
|
||||
{
|
||||
return Ok(send_event_to_device::v3::Response {});
|
||||
return Ok(RumaResponse(send_event_to_device::v3::Response {}));
|
||||
}
|
||||
|
||||
for (target_user_id, map) in &body.messages {
|
||||
|
|
@ -103,5 +103,5 @@ pub(crate) async fn send_event_to_device_route(
|
|||
&[],
|
||||
)?;
|
||||
|
||||
Ok(send_event_to_device::v3::Response {})
|
||||
Ok(RumaResponse(send_event_to_device::v3::Response {}))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue