mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
refactor: Fix errors in api/client/redact.rs
This commit is contained in:
@@ -2,7 +2,7 @@ use axum::extract::State;
|
|||||||
use axum_client_ip::ClientIp;
|
use axum_client_ip::ClientIp;
|
||||||
use conduwuit::{Err, Result, matrix::pdu::PartialPdu};
|
use conduwuit::{Err, Result, matrix::pdu::PartialPdu};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::client::redact::redact_event, events::room::redaction::RoomRedactionEventContent,
|
api::client::redact::redact_event, assign, events::room::redaction::RoomRedactionEventContent,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
@@ -28,7 +28,7 @@ pub(crate) async fn redact_event_route(
|
|||||||
return Err!(Request(UserSuspended("You cannot perform this action while suspended.")));
|
return Err!(Request(UserSuspended("You cannot perform this action while suspended.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
let state_lock = services.rooms.state.mutex.lock(&body.room_id).await;
|
let state_lock = services.rooms.state.mutex.lock(body.room_id.as_str()).await;
|
||||||
|
|
||||||
let event_id = services
|
let event_id = services
|
||||||
.rooms
|
.rooms
|
||||||
@@ -36,10 +36,11 @@ pub(crate) async fn redact_event_route(
|
|||||||
.build_and_append_pdu(
|
.build_and_append_pdu(
|
||||||
PartialPdu {
|
PartialPdu {
|
||||||
redacts: Some(body.event_id.clone()),
|
redacts: Some(body.event_id.clone()),
|
||||||
..PartialPdu::timeline(&RoomRedactionEventContent {
|
..PartialPdu::timeline(
|
||||||
redacts: Some(body.event_id.clone()),
|
&assign!(RoomRedactionEventContent::new_v11(body.event_id.clone()), {
|
||||||
reason: body.reason.clone(),
|
reason: body.reason.clone()
|
||||||
})
|
}),
|
||||||
|
)
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
Some(&body.room_id),
|
Some(&body.room_id),
|
||||||
@@ -49,5 +50,5 @@ pub(crate) async fn redact_event_route(
|
|||||||
|
|
||||||
drop(state_lock);
|
drop(state_lock);
|
||||||
|
|
||||||
Ok(redact_event::v3::Response { event_id })
|
Ok(redact_event::v3::Response::new(event_id))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user