Fix longstanding bug that breaks initial community view (fixes #3529)

This commit is contained in:
Felix Ableitner 2024-03-14 17:07:19 +01:00
parent 255e695633
commit 0f3b883829
3 changed files with 19 additions and 10 deletions

View file

@ -27,7 +27,10 @@ pub async fn list_comments(
check_private_instance(&local_user_view, &local_site)?;
let community_id = if let Some(name) = &data.community_name {
Some(resolve_actor_identifier::<ApubCommunity, Community>(name, &context, &None, true).await?)
Some(
resolve_actor_identifier::<ApubCommunity, Community>(name, &context, &local_user_view, true)
.await?,
)
.map(|c| c.id)
} else {
data.community_id

View file

@ -30,7 +30,10 @@ pub async fn list_posts(
let page = data.page;
let limit = data.limit;
let community_id = if let Some(name) = &data.community_name {
Some(resolve_actor_identifier::<ApubCommunity, Community>(name, &context, &None, true).await?)
Some(
resolve_actor_identifier::<ApubCommunity, Community>(name, &context, &local_user_view, true)
.await?,
)
.map(|c| c.id)
} else {
data.community_id

View file

@ -177,18 +177,21 @@ impl Object for ApubCommunity {
let community: ApubCommunity = community.into();
// Fetching mods and outbox is not necessary for Lemmy to work, so ignore errors. Besides,
// we need to ignore these errors so that tests can work entirely offline.
// These collections are not necessary for Lemmy to work, so ignore errors.
let community_ = community.clone();
let context_ = context.reset_request_count();
spawn_try_task(async move {
group.outbox.dereference(&community_, &context_).await?;
group.followers.dereference(&community_, &context_).await?;
group.outbox.dereference(&community_, &context_).await.ok();
group
.followers
.dereference(&community_, &context_)
.await
.ok();
if let Some(featured) = group.featured {
featured.dereference(&community_, &context_).await?;
featured.dereference(&community_, &context_).await.ok();
}
if let Some(moderators) = group.attributed_to {
moderators.dereference(&community_, &context_).await?;
moderators.dereference(&community_, &context_).await.ok();
}
Ok(())
});