bump ruwuma
Signed-off-by: strawberry <june@girlboss.ceo>
This commit is contained in:
parent
f47677c995
commit
c614d5bf44
4 changed files with 42 additions and 33 deletions
|
@ -272,7 +272,7 @@ pub(crate) async fn set_profile_key_route(
|
|||
)));
|
||||
}
|
||||
|
||||
let Some(profile_key_value) = body.kv_pair.get(&body.key) else {
|
||||
let Some(profile_key_value) = body.kv_pair.get(&body.key_name) else {
|
||||
return Err!(Request(BadJson(
|
||||
"The key does not match the URL field key, or JSON body is empty (use DELETE)"
|
||||
)));
|
||||
|
@ -290,7 +290,7 @@ pub(crate) async fn set_profile_key_route(
|
|||
return Err!(Request(BadJson("Key names cannot be longer than 128 bytes")));
|
||||
}
|
||||
|
||||
if body.key == "displayname" {
|
||||
if body.key_name == "displayname" {
|
||||
let all_joined_rooms: Vec<OwnedRoomId> = services
|
||||
.rooms
|
||||
.state_cache
|
||||
|
@ -306,7 +306,7 @@ pub(crate) async fn set_profile_key_route(
|
|||
&all_joined_rooms,
|
||||
)
|
||||
.await;
|
||||
} else if body.key == "avatar_url" {
|
||||
} else if body.key_name == "avatar_url" {
|
||||
let mxc = ruma::OwnedMxcUri::from(profile_key_value.to_string());
|
||||
|
||||
let all_joined_rooms: Vec<OwnedRoomId> = services
|
||||
|
@ -319,9 +319,11 @@ pub(crate) async fn set_profile_key_route(
|
|||
|
||||
update_avatar_url(&services, &body.user_id, Some(mxc), None, &all_joined_rooms).await;
|
||||
} else {
|
||||
services
|
||||
.users
|
||||
.set_profile_key(&body.user_id, &body.key, Some(profile_key_value.clone()));
|
||||
services.users.set_profile_key(
|
||||
&body.user_id,
|
||||
&body.key_name,
|
||||
Some(profile_key_value.clone()),
|
||||
);
|
||||
}
|
||||
|
||||
if services.globals.allow_local_presence() {
|
||||
|
@ -357,7 +359,7 @@ pub(crate) async fn delete_profile_key_route(
|
|||
)));
|
||||
}
|
||||
|
||||
if body.key == "displayname" {
|
||||
if body.key_name == "displayname" {
|
||||
let all_joined_rooms: Vec<OwnedRoomId> = services
|
||||
.rooms
|
||||
.state_cache
|
||||
|
@ -367,7 +369,7 @@ pub(crate) async fn delete_profile_key_route(
|
|||
.await;
|
||||
|
||||
update_displayname(&services, &body.user_id, None, &all_joined_rooms).await;
|
||||
} else if body.key == "avatar_url" {
|
||||
} else if body.key_name == "avatar_url" {
|
||||
let all_joined_rooms: Vec<OwnedRoomId> = services
|
||||
.rooms
|
||||
.state_cache
|
||||
|
@ -380,7 +382,7 @@ pub(crate) async fn delete_profile_key_route(
|
|||
} else {
|
||||
services
|
||||
.users
|
||||
.set_profile_key(&body.user_id, &body.key, None);
|
||||
.set_profile_key(&body.user_id, &body.key_name, None);
|
||||
}
|
||||
|
||||
if services.globals.allow_local_presence() {
|
||||
|
@ -497,11 +499,13 @@ pub(crate) async fn get_profile_key_route(
|
|||
.users
|
||||
.set_timezone(&body.user_id, response.tz.clone());
|
||||
|
||||
if let Some(value) = response.custom_profile_fields.get(&body.key) {
|
||||
profile_key_value.insert(body.key.clone(), value.clone());
|
||||
services
|
||||
.users
|
||||
.set_profile_key(&body.user_id, &body.key, Some(value.clone()));
|
||||
if let Some(value) = response.custom_profile_fields.get(&body.key_name) {
|
||||
profile_key_value.insert(body.key_name.clone(), value.clone());
|
||||
services.users.set_profile_key(
|
||||
&body.user_id,
|
||||
&body.key_name,
|
||||
Some(value.clone()),
|
||||
);
|
||||
} else {
|
||||
return Err!(Request(NotFound("The requested profile key does not exist.")));
|
||||
}
|
||||
|
@ -520,8 +524,12 @@ pub(crate) async fn get_profile_key_route(
|
|||
return Err!(Request(NotFound("Profile was not found.")));
|
||||
}
|
||||
|
||||
if let Ok(value) = services.users.profile_key(&body.user_id, &body.key).await {
|
||||
profile_key_value.insert(body.key.clone(), value);
|
||||
if let Ok(value) = services
|
||||
.users
|
||||
.profile_key(&body.user_id, &body.key_name)
|
||||
.await
|
||||
{
|
||||
profile_key_value.insert(body.key_name.clone(), value);
|
||||
} else {
|
||||
return Err!(Request(NotFound("The requested profile key does not exist.")));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue