chore: deprecate old add friend route

This commit is contained in:
Paul Makles
2022-07-07 13:20:03 +01:00
parent 30c7f553d8
commit 386f027a5a

View File

@@ -10,11 +10,7 @@ use rocket::State;
#[openapi(tag = "Relationships")]
#[put("/<target>/friend")]
pub async fn req(db: &State<Database>, user: User, target: Ref) -> Result<Json<User>> {
let mut target = if let Ok(user) = db.fetch_user_by_username(&target.id).await {
user
} else {
target.as_user(db).await?
};
let mut target = target.as_user(db).await?;
if user.bot.is_some() || target.bot.is_some() {
return Err(Error::IsBot);