mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew.git
synced 2025-05-13 11:37:33 -05:00
POST /api/user: Only set what was sent
This commit is contained in:
parent
7b92f01bcb
commit
2576ad22ce
2 changed files with 10 additions and 3 deletions
|
@ -54,8 +54,16 @@ pub fn user_post(req: HttpRequest, body: String) -> HttpResponse {
|
||||||
let mut user = userdata::get_acc(&key);
|
let mut user = userdata::get_acc(&key);
|
||||||
let user_2 = userdata::get_acc_home(&key);
|
let user_2 = userdata::get_acc_home(&key);
|
||||||
|
|
||||||
|
if !body["name"].is_null() {
|
||||||
user["user"]["name"] = body["name"].clone();
|
user["user"]["name"] = body["name"].clone();
|
||||||
|
}
|
||||||
|
if !body["friend_request_disabled"].is_null() {
|
||||||
user["user"]["friend_request_disabled"] = body["friend_request_disabled"].clone();
|
user["user"]["friend_request_disabled"] = body["friend_request_disabled"].clone();
|
||||||
|
}
|
||||||
|
if !body["profile_settings"].is_null() {
|
||||||
|
user["user"]["profile_settings"] = body["profile_settings"].clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
userdata::save_acc(&key, user.clone());
|
userdata::save_acc(&key, user.clone());
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ use rusqlite::{Connection, params};
|
||||||
use std::sync::{Mutex, MutexGuard};
|
use std::sync::{Mutex, MutexGuard};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use json::{JsonValue, array, object};
|
use json::{JsonValue, array, object};
|
||||||
use base64::{Engine as _, engine::general_purpose};
|
|
||||||
use crate::router::global;
|
use crate::router::global;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
|
|
Loading…
Add table
Reference in a new issue