From 835d3291344af94f4b7d4878e06d33d07c671092 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Thu, 14 Mar 2024 21:57:56 +0100 Subject: [PATCH] Fix longstanding bug that breaks initial community view (fixes #3529) (#4535) --- crates/apub/src/api/list_comments.rs | 7 +++++-- crates/apub/src/api/list_posts.rs | 7 +++++-- crates/apub/src/objects/community.rs | 15 +++++++++------ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/crates/apub/src/api/list_comments.rs b/crates/apub/src/api/list_comments.rs index 3ae85cdcc..c83756f54 100644 --- a/crates/apub/src/api/list_comments.rs +++ b/crates/apub/src/api/list_comments.rs @@ -27,8 +27,11 @@ 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::(name, &context, &None, true).await?) - .map(|c| c.id) + Some( + resolve_actor_identifier::(name, &context, &local_user_view, true) + .await?, + ) + .map(|c| c.id) } else { data.community_id }; diff --git a/crates/apub/src/api/list_posts.rs b/crates/apub/src/api/list_posts.rs index b2ca95648..384f1b60e 100644 --- a/crates/apub/src/api/list_posts.rs +++ b/crates/apub/src/api/list_posts.rs @@ -30,8 +30,11 @@ 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::(name, &context, &None, true).await?) - .map(|c| c.id) + Some( + resolve_actor_identifier::(name, &context, &local_user_view, true) + .await?, + ) + .map(|c| c.id) } else { data.community_id }; diff --git a/crates/apub/src/objects/community.rs b/crates/apub/src/objects/community.rs index ad8472915..e71f6d9b5 100644 --- a/crates/apub/src/objects/community.rs +++ b/crates/apub/src/objects/community.rs @@ -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(()) });