From: Felix Ableitner Date: Wed, 8 Apr 2020 16:39:45 +0000 (+0200) Subject: Simplify fetch_posts code X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/%24%7B%60data:application/%22https:/hacktivis.me/%7Bthis.state.thumbnail%7D?a=commitdiff_plain;h=f5b58bcdaf5b7200d33bff943617ea803806431b;p=lemmy.git Simplify fetch_posts code --- diff --git a/server/src/apub/puller.rs b/server/src/apub/puller.rs index 7610d464..a00f4d46 100644 --- a/server/src/apub/puller.rs +++ b/server/src/apub/puller.rs @@ -75,18 +75,12 @@ where } fn fetch_remote_community_posts( - instance: &Instance, community: &Community, conn: &PgConnection, ) -> Result, Error> { // TODO: need to add outbox field to Community - let endpoint = Url::parse(&format!( - "http://{}/federation/c/{}", - instance.domain, community.name - ))?; - let group = fetch_remote_object::(&endpoint)?; - let outbox_uri = Url::parse(&group.extension.get_outbox().to_string())?; - let outbox = fetch_remote_object::(&outbox_uri)?; + let outbox_url = Url::parse(&format!("{}/outbox", community.actor_id))?; + let outbox = fetch_remote_object::(&outbox_url)?; let items = outbox.collection_props.get_many_items_base_boxes(); Ok( @@ -129,7 +123,7 @@ pub fn fetch_all(conn: &PgConnection) -> Result<(), Error> { if let Some(community_list) = node_info.metadata.community_list_url { let communities = fetch_communities_from_instance(&community_list, conn)?; for c in communities { - fetch_remote_community_posts(instance, &c, conn)?; + fetch_remote_community_posts(&c, conn)?; } } else { warn!(