Fix: Prevent users banning themselves.

This commit is contained in:
Paul
2021-06-16 15:46:54 +01:00
parent 9a2ccecb89
commit 6d67b3f767

View File

@@ -30,6 +30,14 @@ pub async fn req(user: User, server: Ref, target: Ref, data: Json<Data>) -> Resu
}
let target = target.fetch_user().await?;
if target.id == user.id {
return Err(Error::InvalidOperation)
}
if target.id == server.owner {
return Err(Error::MissingPermission)
}
let mut document = doc! {
"_id": {
"server": &server.id,