mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-11-30 22:43:10 +00:00
fix: check if you've left the room before forgetting it
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
1ac72ab914
commit
9b096cc67b
|
@ -509,6 +509,17 @@ pub(crate) async fn unban_user_route(body: Ruma<unban_user::v3::Request>) -> Res
|
|||
pub(crate) async fn forget_room_route(body: Ruma<forget_room::v3::Request>) -> Result<forget_room::v3::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
if services()
|
||||
.rooms
|
||||
.state_cache
|
||||
.is_joined(sender_user, &body.room_id)?
|
||||
{
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::Unknown,
|
||||
"You must leave the room before forgetting it",
|
||||
));
|
||||
}
|
||||
|
||||
services()
|
||||
.rooms
|
||||
.state_cache
|
||||
|
|
Loading…
Reference in a new issue