mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-06-29 22:44:35 +02:00
feat: Prevent suspended users redacting events
This commit is contained in:
parent
accfda2586
commit
286974cb9a
1 changed files with 5 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
use axum::extract::State;
|
||||
use conduwuit::{Result, matrix::pdu::PduBuilder};
|
||||
use conduwuit::{Err, Result, matrix::pdu::PduBuilder};
|
||||
use ruma::{
|
||||
api::client::redact::redact_event, events::room::redaction::RoomRedactionEventContent,
|
||||
};
|
||||
|
@ -17,6 +17,10 @@ pub(crate) async fn redact_event_route(
|
|||
) -> Result<redact_event::v3::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
let body = body.body;
|
||||
if services.users.is_suspended(sender_user).await? {
|
||||
// TODO: Users can redact their own messages 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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue