Dont return "admin" for GET user when no id/name is provided (fixes #1546) (#2233)

This commit is contained in:
Nutomic 2022-04-25 23:16:29 +02:00 committed by GitHub
parent ae84258c41
commit 3488b9aeb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
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",
));
}
}
};