Fix: Prevent users banning themselves.
This commit is contained in:
1 parent
9a2ccecb89
commit
6d67b3f767
1 file changed
+8
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user