mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-15 21:26:50 +00:00
Introduce deactivate, membership services Move membership and user deactivation functions from api crate into those services
33 lines
689 B
Rust
33 lines
689 B
Rust
use axum::extract::State;
|
|
use futures::FutureExt;
|
|
use ruma::api::client::membership::unban_user;
|
|
use tuwunel_core::Result;
|
|
|
|
use crate::Ruma;
|
|
|
|
/// # `POST /_matrix/client/r0/rooms/{roomId}/unban`
|
|
///
|
|
/// Tries to send an unban event into the room.
|
|
pub(crate) async fn unban_user_route(
|
|
State(services): State<crate::State>,
|
|
body: Ruma<unban_user::v3::Request>,
|
|
) -> Result<unban_user::v3::Response> {
|
|
let state_lock = services.state.mutex.lock(&body.room_id).await;
|
|
|
|
services
|
|
.membership
|
|
.unban(
|
|
&body.room_id,
|
|
&body.user_id,
|
|
body.reason.as_ref(),
|
|
body.sender_user(),
|
|
&state_lock,
|
|
)
|
|
.boxed()
|
|
.await?;
|
|
|
|
drop(state_lock);
|
|
|
|
Ok(unban_user::v3::Response::new())
|
|
}
|