From 5ba09005afd1ed7370063ad870724c6dd0683d73 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Thu, 2 Jun 2022 14:42:29 +0200 Subject: [PATCH] Remove generic Error param from ObjectId functions --- examples/federation/activities/follow.rs | 3 +-- examples/federation/instance.rs | 2 +- examples/federation/objects/note.rs | 3 +-- examples/federation/objects/person.rs | 2 +- src/core/inbox.rs | 2 +- src/core/object_id.rs | 4 ++-- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/examples/federation/activities/follow.rs b/examples/federation/activities/follow.rs index bf99ceb..5638471 100644 --- a/examples/federation/activities/follow.rs +++ b/examples/federation/activities/follow.rs @@ -6,7 +6,6 @@ use crate::{ }; use activitypub_federation::{core::object_id::ObjectId, data::Data, traits::ActivityHandler}; use activitystreams_kinds::activity::FollowType; -use anyhow::Error; use serde::{Deserialize, Serialize}; use url::Url; @@ -67,7 +66,7 @@ impl ActivityHandler for Follow { // send back an accept let follower = self .actor - .dereference::(data, data.local_instance(), request_counter) + .dereference(data, data.local_instance(), request_counter) .await?; let id = generate_object_id(data.local_instance().hostname())?; let accept = Accept::new(local_user.ap_id.clone(), self, id.clone()); diff --git a/examples/federation/instance.rs b/examples/federation/instance.rs index adb930e..4943178 100644 --- a/examples/federation/instance.rs +++ b/examples/federation/instance.rs @@ -97,7 +97,7 @@ async fn http_get_user( let request_url = format!("http://{}{}", hostname, &request.uri().to_string()); let url = Url::parse(&request_url)?; let user = ObjectId::::new(url) - .dereference_local::(&data) + .dereference_local(&data) .await? .into_apub(&data) .await?; diff --git a/examples/federation/objects/note.rs b/examples/federation/objects/note.rs index a988413..993dc08 100644 --- a/examples/federation/objects/note.rs +++ b/examples/federation/objects/note.rs @@ -5,7 +5,6 @@ use activitypub_federation::{ traits::ApubObject, }; use activitystreams_kinds::{object::NoteType, public}; -use anyhow::Error; use serde::{Deserialize, Serialize}; use url::Url; @@ -55,7 +54,7 @@ impl ApubObject for MyPost { } async fn into_apub(self, data: &Self::DataType) -> Result { - let creator = self.creator.dereference_local::(data).await?; + let creator = self.creator.dereference_local(data).await?; Ok(Note { kind: Default::default(), id: self.ap_id, diff --git a/examples/federation/objects/person.rs b/examples/federation/objects/person.rs index ecc82a2..6cc5cfd 100644 --- a/examples/federation/objects/person.rs +++ b/examples/federation/objects/person.rs @@ -102,7 +102,7 @@ impl MyUser { let mut inboxes = vec![]; for f in self.followers.clone() { let user: MyUser = ObjectId::new(f) - .dereference::(instance, instance.local_instance(), &mut 0) + .dereference(instance, instance.local_instance(), &mut 0) .await?; inboxes.push(user.inbox); } diff --git a/src/core/inbox.rs b/src/core/inbox.rs index b84a11a..1fe2c0f 100644 --- a/src/core/inbox.rs +++ b/src/core/inbox.rs @@ -36,7 +36,7 @@ where let request_counter = &mut 0; let actor = ObjectId::::new(activity.actor().clone()) - .dereference::(data, local_instance, request_counter) + .dereference(data, local_instance, request_counter) .await?; verify_signature(&request, actor.public_key())?; diff --git a/src/core/object_id.rs b/src/core/object_id.rs index 855df62..5f9c48e 100644 --- a/src/core/object_id.rs +++ b/src/core/object_id.rs @@ -37,7 +37,7 @@ where } /// Fetches an activitypub object, either from local database (if possible), or over http. - pub async fn dereference( + pub async fn dereference( &self, data: &::DataType, instance: &LocalInstance, @@ -77,7 +77,7 @@ where /// Fetch an object from the local db. Instead of falling back to http, this throws an error if /// the object is not found in the database. - pub async fn dereference_local( + pub async fn dereference_local( &self, data: &::DataType, ) -> Result::Error>