ignore potential errors when updating user profiles

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-01-14 01:24:49 -05:00 committed by June
parent 4d410d7304
commit 9ec1532580
1 changed files with 27 additions and 21 deletions

View File

@ -127,16 +127,18 @@ pub async fn get_displayname_route(
.await?; .await?;
// Create and update our local copy of the user // Create and update our local copy of the user
services().users.create(&body.user_id, None)?; // these are `let _` because it's fine if we can't find these for the user.
services() // also these requests are sent on room join so dead servers will make room joins annoying again
let _ = services().users.create(&body.user_id, None);
let _ = services()
.users .users
.set_displayname(&body.user_id, response.displayname.clone())?; .set_displayname(&body.user_id, response.displayname.clone());
services() let _ = services()
.users .users
.set_avatar_url(&body.user_id, response.avatar_url)?; .set_avatar_url(&body.user_id, response.avatar_url);
services() let _ = services()
.users .users
.set_blurhash(&body.user_id, response.blurhash)?; .set_blurhash(&body.user_id, response.blurhash);
return Ok(get_display_name::v3::Response { return Ok(get_display_name::v3::Response {
displayname: response.displayname, displayname: response.displayname,
@ -264,16 +266,18 @@ pub async fn get_avatar_url_route(
.await?; .await?;
// Create and update our local copy of the user // Create and update our local copy of the user
services().users.create(&body.user_id, None)?; // these are `let _` because it's fine if we can't find these for the user.
services() // also these requests are sent on room join so dead servers will make room joins annoying again
let _ = services().users.create(&body.user_id, None);
let _ = services()
.users .users
.set_displayname(&body.user_id, response.displayname)?; .set_displayname(&body.user_id, response.displayname);
services() let _ = services()
.users .users
.set_avatar_url(&body.user_id, response.avatar_url.clone())?; .set_avatar_url(&body.user_id, response.avatar_url.clone());
services() let _ = services()
.users .users
.set_blurhash(&body.user_id, response.blurhash.clone())?; .set_blurhash(&body.user_id, response.blurhash.clone());
return Ok(get_avatar_url::v3::Response { return Ok(get_avatar_url::v3::Response {
avatar_url: response.avatar_url, avatar_url: response.avatar_url,
@ -311,16 +315,18 @@ pub async fn get_profile_route(
.await?; .await?;
// Create and update our local copy of the user // Create and update our local copy of the user
services().users.create(&body.user_id, None)?; // these are `let _` because it's fine if we can't find these for the user.
services() // also these requests are sent on room join so dead servers will make room joins annoying again
let _ = services().users.create(&body.user_id, None);
let _ = services()
.users .users
.set_displayname(&body.user_id, response.displayname.clone())?; .set_displayname(&body.user_id, response.displayname.clone());
services() let _ = services()
.users .users
.set_avatar_url(&body.user_id, response.avatar_url.clone())?; .set_avatar_url(&body.user_id, response.avatar_url.clone());
services() let _ = services()
.users .users
.set_blurhash(&body.user_id, response.blurhash.clone())?; .set_blurhash(&body.user_id, response.blurhash.clone());
return Ok(get_profile::v3::Response { return Ok(get_profile::v3::Response {
displayname: response.displayname, displayname: response.displayname,