mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-12-28 13:33:47 +03:00
fix: make element not show "unknown user" warning
The 404 error for /profile in the spec says "There is no profile information for this user or this user does not exist.", but Element assumes every 404 is a user that does not exist.
This commit is contained in:
parent
df55e8ed0b
commit
515465f900
1 changed files with 4 additions and 7 deletions
|
@ -217,11 +217,8 @@ pub fn get_profile_route(
|
|||
db: State<'_, Database>,
|
||||
body: Ruma<get_profile::Request>,
|
||||
) -> ConduitResult<get_profile::Response> {
|
||||
let avatar_url = db.users.avatar_url(&body.user_id)?;
|
||||
let displayname = db.users.displayname(&body.user_id)?;
|
||||
|
||||
if avatar_url.is_none() && displayname.is_none() {
|
||||
// Return 404 if we don't have a profile for this id
|
||||
if !db.users.exists(&body.user_id)? {
|
||||
// Return 404 if this user doesn't exist
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::NotFound,
|
||||
"Profile was not found.",
|
||||
|
@ -229,8 +226,8 @@ pub fn get_profile_route(
|
|||
}
|
||||
|
||||
Ok(get_profile::Response {
|
||||
avatar_url,
|
||||
displayname,
|
||||
avatar_url: db.users.avatar_url(&body.user_id)?,
|
||||
displayname: db.users.displayname(&body.user_id)?,
|
||||
}
|
||||
.into())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue