fix: don't allow mutual route if self

This commit is contained in:
Paul Makles
2022-04-29 13:07:33 +01:00
parent 6281418ecb
commit 278d795d50

View File

@@ -22,6 +22,10 @@ pub struct MutualResponse {
pub async fn req(db: &State<Database>, user: User, target: Ref) -> Result<Json<MutualResponse>> {
let target = target.as_user(db).await?;
if target.id == user.id {
return Err(Error::InvalidOperation);
}
if perms(&user)
.user(&target)
.calc_user(db)