Skip to content

Commit

Permalink
Dont return "admin" for GET user when no id/name is provided (fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Nutomic committed Apr 22, 2022
1 parent 7e13406 commit b561fc5
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions crates/api_crud/src/user/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@ impl PerformCrud for GetPersonDetails {
let person_details_id = match data.person_id {
Some(id) => id,
None => {
let name = data
.username
.to_owned()
.unwrap_or_else(|| "admin".to_string());

resolve_actor_identifier::<ApubPerson, Person>(&name, context)
.await
.map_err(|e| e.with_message("couldnt_find_that_username_or_email"))?
.id
if let Some(username) = &data.username {
resolve_actor_identifier::<ApubPerson, Person>(username, context)
.await
.map_err(|e| e.with_message("couldnt_find_that_username_or_email"))?
.id
} else {
return Err(LemmyError::from_message(
"couldnt_find_that_username_or_email",
));
}
}
};

Expand Down

0 comments on commit b561fc5

Please sign in to comment.