Update CORS options.

Disallow bots to be added as friends.
This commit is contained in:
Paul
2021-08-15 23:11:33 +01:00
parent f04137d50f
commit bffac8c4c0
4 changed files with 20 additions and 2 deletions

View File

@@ -36,6 +36,9 @@ pub async fn req(user: User, username: String) -> Result<Value> {
})?;
let target_user = Ref::from(target_id.to_string())?.fetch_user().await?;
if target_user.bot.is_some() {
return Err(Error::IsBot)
}
match get_relationship(&user, &target_id) {
RelationshipStatus::User => return Err(Error::NoEffect),