forked from jmug/stoatchat
fix: don't allow mutual route if self
This commit is contained in:
@@ -22,6 +22,10 @@ pub struct MutualResponse {
|
|||||||
pub async fn req(db: &State<Database>, user: User, target: Ref) -> Result<Json<MutualResponse>> {
|
pub async fn req(db: &State<Database>, user: User, target: Ref) -> Result<Json<MutualResponse>> {
|
||||||
let target = target.as_user(db).await?;
|
let target = target.as_user(db).await?;
|
||||||
|
|
||||||
|
if target.id == user.id {
|
||||||
|
return Err(Error::InvalidOperation);
|
||||||
|
}
|
||||||
|
|
||||||
if perms(&user)
|
if perms(&user)
|
||||||
.user(&target)
|
.user(&target)
|
||||||
.calc_user(db)
|
.calc_user(db)
|
||||||
|
|||||||
Reference in New Issue
Block a user