fix duplicate timezone keys being sent on profile lookup requests
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
a752fb9943
commit
35e9d9b02e
2 changed files with 15 additions and 5 deletions
|
@ -273,16 +273,22 @@ pub(crate) async fn get_profile_route(
|
||||||
return Err(Error::BadRequest(ErrorKind::NotFound, "Profile was not found."));
|
return Err(Error::BadRequest(ErrorKind::NotFound, "Profile was not found."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut custom_profile_fields: BTreeMap<String, serde_json::Value> = services
|
||||||
|
.users
|
||||||
|
.all_profile_keys(&body.user_id)
|
||||||
|
.collect()
|
||||||
|
.await;
|
||||||
|
|
||||||
|
// services.users.timezone will collect the MSC4175 timezone key if it exists
|
||||||
|
custom_profile_fields.remove("us.cloke.msc4175.tz");
|
||||||
|
custom_profile_fields.remove("m.tz");
|
||||||
|
|
||||||
Ok(get_profile::v3::Response {
|
Ok(get_profile::v3::Response {
|
||||||
avatar_url: services.users.avatar_url(&body.user_id).await.ok(),
|
avatar_url: services.users.avatar_url(&body.user_id).await.ok(),
|
||||||
blurhash: services.users.blurhash(&body.user_id).await.ok(),
|
blurhash: services.users.blurhash(&body.user_id).await.ok(),
|
||||||
displayname: services.users.displayname(&body.user_id).await.ok(),
|
displayname: services.users.displayname(&body.user_id).await.ok(),
|
||||||
tz: services.users.timezone(&body.user_id).await.ok(),
|
tz: services.users.timezone(&body.user_id).await.ok(),
|
||||||
custom_profile_fields: services
|
custom_profile_fields,
|
||||||
.users
|
|
||||||
.all_profile_keys(&body.user_id)
|
|
||||||
.collect()
|
|
||||||
.await,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,10 @@ pub(crate) async fn get_profile_information_route(
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// services.users.timezone will collect the MSC4175 timezone key if it exists
|
||||||
|
custom_profile_fields.remove("us.cloke.msc4175.tz");
|
||||||
|
custom_profile_fields.remove("m.tz");
|
||||||
|
|
||||||
Ok(get_profile_information::v1::Response {
|
Ok(get_profile_information::v1::Response {
|
||||||
displayname,
|
displayname,
|
||||||
avatar_url,
|
avatar_url,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue