Remove generic param error from receive_activity()

This commit is contained in:
Felix Ableitner 2022-06-02 18:23:27 +02:00
parent 09f8baf764
commit 31da95af95
2 changed files with 8 additions and 6 deletions

View file

@ -114,7 +114,7 @@ async fn http_post_user_inbox(
) -> Result<HttpResponse, Error> { ) -> Result<HttpResponse, Error> {
let data: InstanceHandle = data.into_inner().deref().clone(); let data: InstanceHandle = data.into_inner().deref().clone();
let activity = serde_json::from_str(&payload)?; let activity = serde_json::from_str(&payload)?;
receive_activity::<WithContext<PersonAcceptedActivities>, MyUser, InstanceHandle, Error>( receive_activity::<WithContext<PersonAcceptedActivities>, MyUser, InstanceHandle>(
request, request,
activity, activity,
&data.clone().local_instance, &data.clone().local_instance,

View file

@ -16,17 +16,19 @@ pub trait ActorPublicKey {
} }
/// Receive an activity and perform some basic checks, including HTTP signature verification. /// Receive an activity and perform some basic checks, including HTTP signature verification.
pub async fn receive_activity<Activity, Actor, Datatype, E>( pub async fn receive_activity<Activity, Actor, Datatype>(
request: HttpRequest, request: HttpRequest,
activity: Activity, activity: Activity,
local_instance: &LocalInstance, local_instance: &LocalInstance,
data: &Data<Datatype>, data: &Data<Datatype>,
) -> Result<HttpResponse, E> ) -> Result<HttpResponse, <Activity as ActivityHandler>::Error>
where where
Activity: ActivityHandler<DataType = Datatype, Error = E> + DeserializeOwned + Send + 'static, Activity: ActivityHandler<DataType = Datatype> + DeserializeOwned + Send + 'static,
Actor: ApubObject<DataType = Datatype, Error = E> + ActorPublicKey + Send + 'static, Actor: ApubObject<DataType = Datatype> + ActorPublicKey + Send + 'static,
for<'de2> <Actor as ApubObject>::ApubType: serde::Deserialize<'de2>, for<'de2> <Actor as ApubObject>::ApubType: serde::Deserialize<'de2>,
E: From<anyhow::Error> + From<Error>, <Activity as ActivityHandler>::Error:
From<anyhow::Error> + From<Error> + From<<Actor as ApubObject>::Error>,
<Actor as ApubObject>::Error: From<Error> + From<anyhow::Error>,
{ {
verify_domains_match(activity.id(), activity.actor())?; verify_domains_match(activity.id(), activity.actor())?;
verify_url_valid(activity.id(), &local_instance.settings)?; verify_url_valid(activity.id(), &local_instance.settings)?;