Send any friends your have as live guests

This commit is contained in:
Ethan O'Brien
2024-04-15 17:04:03 -05:00
parent d4ae8f7c5c
commit 60f8e96406
4 changed files with 85 additions and 12 deletions

View File

@ -22,9 +22,7 @@ pub fn friend(req: HttpRequest, body: String) -> HttpResponse {
};
for (_i, uid) in rv_data.members().enumerate() {
let mut to_push = global::get_user(uid.as_i64().unwrap());
to_push["status"] = body["status"].clone();
rv.push(to_push).unwrap();
rv.push(global::get_user(uid.as_i64().unwrap(), &friends)).unwrap();
}
let resp = object!{
@ -61,11 +59,13 @@ pub fn recommend(_req: HttpRequest, _body: String) -> HttpResponse {
global::send(resp)
}
pub fn search(_req: HttpRequest, body: String) -> HttpResponse {
pub fn search(req: HttpRequest, body: String) -> HttpResponse {
let key = global::get_login(req.headers(), &body);
let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
let friends = userdata::get_acc_friends(&key);
let uid = body["user_id"].as_i64().unwrap();
let user = global::get_user(uid);
let user = global::get_user(uid, &friends);
let resp = object!{
"code": 0,