]> Untitled Git - lemmy.git/blobdiff - crates/apub/src/fetcher/person.rs
Rewrite activitypub following, person, community, pm (#1692)
[lemmy.git] / crates / apub / src / fetcher / person.rs
index 4e6191abb035a25777b19effdaec3b45bc6ac577..3acedb0863f183b27bd67149b8bc6250d15024b7 100644 (file)
@@ -1,7 +1,6 @@
 use crate::{
   fetcher::{fetch::fetch_remote_object, is_deleted, should_refetch_actor},
-  objects::FromApub,
-  PersonExt,
+  objects::{person::Person as ApubPerson, FromApub},
 };
 use anyhow::anyhow;
 use diesel::result::Error::NotFound;
@@ -33,7 +32,7 @@ pub async fn get_or_fetch_and_upsert_person(
     Ok(u) if !u.local && should_refetch_actor(u.last_refreshed_at) => {
       debug!("Fetching and updating from remote person: {}", apub_id);
       let person =
-        fetch_remote_object::<PersonExt>(context.client(), apub_id, recursion_counter).await;
+        fetch_remote_object::<ApubPerson>(context.client(), apub_id, recursion_counter).await;
 
       if is_deleted(&person) {
         // TODO: use Person::update_deleted() once implemented
@@ -46,14 +45,7 @@ pub async fn get_or_fetch_and_upsert_person(
         return Ok(u);
       }
 
-      let person = Person::from_apub(
-        &person?,
-        context,
-        apub_id.to_owned(),
-        recursion_counter,
-        false,
-      )
-      .await?;
+      let person = Person::from_apub(&person?, context, apub_id, recursion_counter).await?;
 
       let person_id = person.id;
       blocking(context.pool(), move |conn| {
@@ -67,16 +59,9 @@ pub async fn get_or_fetch_and_upsert_person(
     Err(NotFound {}) => {
       debug!("Fetching and creating remote person: {}", apub_id);
       let person =
-        fetch_remote_object::<PersonExt>(context.client(), apub_id, recursion_counter).await?;
+        fetch_remote_object::<ApubPerson>(context.client(), apub_id, recursion_counter).await?;
 
-      let person = Person::from_apub(
-        &person,
-        context,
-        apub_id.to_owned(),
-        recursion_counter,
-        false,
-      )
-      .await?;
+      let person = Person::from_apub(&person, context, apub_id, recursion_counter).await?;
 
       Ok(person)
     }