mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
fix: Properly deserialize changes to legacy fields made with MSC4133 endpoints
This commit is contained in:
@@ -163,6 +163,9 @@ pub(crate) async fn set_profile_key_route(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if body.key_name == "displayname" {
|
if body.key_name == "displayname" {
|
||||||
|
let Some(display_name) = profile_key_value.as_str() else {
|
||||||
|
return Err!(Request(BadJson("displayname must be a string")));
|
||||||
|
};
|
||||||
let all_joined_rooms: Vec<OwnedRoomId> = services
|
let all_joined_rooms: Vec<OwnedRoomId> = services
|
||||||
.rooms
|
.rooms
|
||||||
.state_cache
|
.state_cache
|
||||||
@@ -174,12 +177,15 @@ pub(crate) async fn set_profile_key_route(
|
|||||||
update_displayname(
|
update_displayname(
|
||||||
&services,
|
&services,
|
||||||
&body.user_id,
|
&body.user_id,
|
||||||
Some(profile_key_value.to_string()),
|
Some(display_name.to_owned()),
|
||||||
&all_joined_rooms,
|
&all_joined_rooms,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
} else if body.key_name == "avatar_url" {
|
} else if body.key_name == "avatar_url" {
|
||||||
let mxc = ruma::OwnedMxcUri::from(profile_key_value.to_string());
|
let Some(avatar_url) = profile_key_value.as_str() else {
|
||||||
|
return Err!(Request(BadJson("avatar_url must be a string")));
|
||||||
|
};
|
||||||
|
let mxc = ruma::OwnedMxcUri::from(avatar_url);
|
||||||
|
|
||||||
let all_joined_rooms: Vec<OwnedRoomId> = services
|
let all_joined_rooms: Vec<OwnedRoomId> = services
|
||||||
.rooms
|
.rooms
|
||||||
|
|||||||
Reference in New Issue
Block a user