]> Untitled Git - lemmy.git/blobdiff - crates/apub/src/fetcher/objects.rs
Merge pull request #1785 from LemmyNet/add_cardano_donation_link
[lemmy.git] / crates / apub / src / fetcher / objects.rs
index fd94f6499575a02df3ce1fedb6e61e301bbc8325..e538982db45c64e6c3ee1f910ace33f5d8500610 100644 (file)
@@ -1,7 +1,6 @@
 use crate::{
   fetcher::fetch::fetch_remote_object,
-  objects::{post::Page, FromApub},
-  NoteExt,
+  objects::{comment::Note, post::Page, FromApub},
   PostOrComment,
 };
 use anyhow::anyhow;
@@ -18,7 +17,7 @@ use url::Url;
 /// pulled from its apub ID, inserted and returned.
 ///
 /// The parent community is also pulled if necessary. Comments are not pulled.
-pub async fn get_or_fetch_and_insert_post(
+pub(crate) async fn get_or_fetch_and_insert_post(
   post_ap_id: &Url,
   context: &LemmyContext,
   recursion_counter: &mut i32,
@@ -35,14 +34,7 @@ pub async fn get_or_fetch_and_insert_post(
       debug!("Fetching and creating remote post: {}", post_ap_id);
       let page =
         fetch_remote_object::<Page>(context.client(), post_ap_id, recursion_counter).await?;
-      let post = Post::from_apub(
-        &page,
-        context,
-        post_ap_id.to_owned(),
-        recursion_counter,
-        false,
-      )
-      .await?;
+      let post = Post::from_apub(&page, context, post_ap_id, recursion_counter).await?;
 
       Ok(post)
     }
@@ -54,7 +46,7 @@ pub async fn get_or_fetch_and_insert_post(
 /// pulled from its apub ID, inserted and returned.
 ///
 /// The parent community, post and comment are also pulled if necessary.
-pub async fn get_or_fetch_and_insert_comment(
+pub(crate) async fn get_or_fetch_and_insert_comment(
   comment_ap_id: &Url,
   context: &LemmyContext,
   recursion_counter: &mut i32,
@@ -73,15 +65,8 @@ pub async fn get_or_fetch_and_insert_comment(
         comment_ap_id
       );
       let comment =
-        fetch_remote_object::<NoteExt>(context.client(), comment_ap_id, recursion_counter).await?;
-      let comment = Comment::from_apub(
-        &comment,
-        context,
-        comment_ap_id.to_owned(),
-        recursion_counter,
-        false,
-      )
-      .await?;
+        fetch_remote_object::<Note>(context.client(), comment_ap_id, recursion_counter).await?;
+      let comment = Comment::from_apub(&comment, context, comment_ap_id, recursion_counter).await?;
 
       let post_id = comment.post_id;
       let post = blocking(context.pool(), move |conn| Post::read(conn, post_id)).await??;
@@ -95,7 +80,7 @@ pub async fn get_or_fetch_and_insert_comment(
   }
 }
 
-pub async fn get_or_fetch_and_insert_post_or_comment(
+pub(crate) async fn get_or_fetch_and_insert_post_or_comment(
   ap_id: &Url,
   context: &LemmyContext,
   recursion_counter: &mut i32,