Removing the conditioned site return.

add_site_to_person_details
Dessalines 2024-01-23 18:42:23 -05:00
parent 2b2c026ad0
commit 36e84f4102
1 changed files with 2 additions and 12 deletions

View File

@ -567,7 +567,7 @@ pub fn check_private_instance_and_federation_enabled(
}
}
/// Read the site for an actor_id, but don't include it if its a local actor.
/// Read the site for an actor_id.
///
/// Used for GetCommunityResponse and GetPersonDetails
pub async fn read_site_for_actor(
@ -576,17 +576,7 @@ pub async fn read_site_for_actor(
) -> Result<Option<Site>, LemmyError> {
let site_id = Site::instance_actor_id_from_url(actor_id.clone().into());
let site = Site::read_from_apub_id(&mut context.pool(), &site_id.into()).await?;
// no need to include metadata for local site (its already available through other endpoints).
// this also prevents us from leaking the federation private key.
if let Some(s) = &site {
if s.actor_id.domain() == Some(context.settings().hostname.as_ref()) {
Ok(None)
} else {
Ok(site)
}
} else {
Ok(site)
}
Ok(site)
}
pub async fn purge_image_posts_for_person(