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 25, 2022
1 parent ae84258 commit 3488b9a
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 3488b9a

Please sign in to comment.