From bee382e1e3b5588aa750f15af34527a1e1783807 Mon Sep 17 00:00:00 2001 From: alemi Date: Thu, 9 Jan 2025 20:49:56 +0100 Subject: [PATCH] fix: when crawling outbox, fetch objects its weird because we get activities in outbox, however pulling activities makes a mess because we may get objects again and have them appear twice, uggg... this way we may effectively not fetch anything (if remote actor liked a ton of stuff, we only get their likes, and the related object is not from them!) but ehhh will do for now --- upub/core/src/traits/fetch.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/upub/core/src/traits/fetch.rs b/upub/core/src/traits/fetch.rs index 38b69e1..e468994 100644 --- a/upub/core/src/traits/fetch.rs +++ b/upub/core/src/traits/fetch.rs @@ -477,8 +477,15 @@ impl Fetcher for crate::Context { // TODO parallelize these - for item in outbox.ordered_items().all_ids() { - self.fetch_activity(&item, tx).await?; + // TODO we're getting inner objects because + // 1) fetching activities makes it look like we're following this actor: is this desirable? + // 2) fetching activities doesn't properly merge addressing, so we get orphan objects twice + for node in outbox.ordered_items().flat() { + if let Ok(activity) = node.into_inner() { + if let Ok(oid) = activity.object().id() { + self.fetch_object(&oid, tx).await?; + } + } } Ok(())