]> Untitled Git - lemmy.git/blobdiff - crates/apub/src/fetcher/user_or_community.rs
Diesel 2.0.0 upgrade (#2452)
[lemmy.git] / crates / apub / src / fetcher / user_or_community.rs
index 7ec5e9dd90cfd4b6494c9bd577cd9feb5b7c9e34..da23ad59a180a85395d27aa9f325e12fa8f4b014 100644 (file)
@@ -2,9 +2,9 @@ use crate::{
   objects::{community::ApubCommunity, person::ApubPerson},
   protocol::objects::{group::Group, person::Person},
 };
+use activitypub_federation::traits::{Actor, ApubObject};
 use chrono::NaiveDateTime;
-use lemmy_apub_lib::traits::{ActorType, ApubObject};
-use lemmy_utils::LemmyError;
+use lemmy_utils::error::LemmyError;
 use lemmy_websocket::LemmyContext;
 use serde::{Deserialize, Serialize};
 use url::Url;
@@ -22,7 +22,7 @@ pub enum PersonOrGroup {
   Group(Group),
 }
 
-#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
+#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
 pub enum PersonOrGroupType {
   Person,
   Group,
@@ -33,7 +33,7 @@ impl ApubObject for UserOrCommunity {
   type DataType = LemmyContext;
   type ApubType = PersonOrGroup;
   type DbType = ();
-  type TombstoneType = ();
+  type Error = LemmyError;
 
   fn last_refreshed_at(&self) -> Option<NaiveDateTime> {
     Some(match self {
@@ -68,10 +68,6 @@ impl ApubObject for UserOrCommunity {
     unimplemented!()
   }
 
-  fn to_tombstone(&self) -> Result<Self::TombstoneType, LemmyError> {
-    unimplemented!()
-  }
-
   #[tracing::instrument(skip_all)]
   async fn verify(
     apub: &Self::ApubType,
@@ -106,30 +102,15 @@ impl ApubObject for UserOrCommunity {
   }
 }
 
-impl ActorType for UserOrCommunity {
-  fn actor_id(&self) -> Url {
-    match self {
-      UserOrCommunity::User(p) => p.actor_id(),
-      UserOrCommunity::Community(p) => p.actor_id(),
-    }
-  }
-
-  fn public_key(&self) -> String {
+impl Actor for UserOrCommunity {
+  fn public_key(&self) -> &str {
     match self {
       UserOrCommunity::User(p) => p.public_key(),
       UserOrCommunity::Community(p) => p.public_key(),
     }
   }
 
-  fn private_key(&self) -> Option<String> {
-    todo!()
-  }
-
-  fn inbox_url(&self) -> Url {
-    todo!()
-  }
-
-  fn shared_inbox_url(&self) -> Option<Url> {
-    todo!()
+  fn inbox(&self) -> Url {
+    unimplemented!()
   }
 }