forked from didirus/AstralRinth
Friends system for app (#2958)
* Friends system for app * Fix impl issues * move friends to in-memory store
This commit is contained in:
@@ -300,6 +300,7 @@ pub struct EditUser {
|
||||
pub badges: Option<Badges>,
|
||||
#[validate(length(max = 160))]
|
||||
pub venmo_handle: Option<String>,
|
||||
pub allow_friend_requests: Option<bool>,
|
||||
}
|
||||
|
||||
pub async fn user_edit(
|
||||
@@ -438,6 +439,20 @@ pub async fn user_edit(
|
||||
.await?;
|
||||
}
|
||||
|
||||
if let Some(allow_friend_requests) = &user.allow_friend_requests {
|
||||
sqlx::query!(
|
||||
"
|
||||
UPDATE users
|
||||
SET allow_friend_requests = $1
|
||||
WHERE (id = $2)
|
||||
",
|
||||
allow_friend_requests,
|
||||
id as crate::database::models::ids::UserId,
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
.await?;
|
||||
}
|
||||
|
||||
transaction.commit().await?;
|
||||
User::clear_caches(&[(id, Some(actual_user.username))], &redis)
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user