]> Untitled Git - lemmy.git/blobdiff - crates/apub/src/http/mod.rs
Make functions work with both connection and pool (#3420)
[lemmy.git] / crates / apub / src / http / mod.rs
index 66d5a0f9fc3240d52b782d0abe753a0c941d0645..52a0144348f0c8197e98a4c94da6625e2ae5aa91 100644 (file)
@@ -14,7 +14,7 @@ use actix_web::{web, web::Bytes, HttpRequest, HttpResponse};
 use http::StatusCode;
 use lemmy_api_common::context::LemmyContext;
 use lemmy_db_schema::source::activity::Activity;
-use lemmy_utils::error::{LemmyError, LemmyResult};
+use lemmy_utils::error::{LemmyError, LemmyErrorType, LemmyResult};
 use serde::{Deserialize, Serialize};
 use std::ops::Deref;
 use url::Url;
@@ -65,7 +65,7 @@ fn create_apub_tombstone_response<T: Into<Url>>(id: T) -> LemmyResult<HttpRespon
 }
 
 fn err_object_not_local() -> LemmyError {
-  LemmyError::from_message("Object not local, fetch it from original instance")
+  LemmyErrorType::ObjectNotLocal.into()
 }
 
 #[derive(Deserialize)]
@@ -88,7 +88,7 @@ pub(crate) async fn get_activity(
     info.id
   ))?
   .into();
-  let activity = Activity::read_from_apub_id(context.pool(), &activity_id).await?;
+  let activity = Activity::read_from_apub_id(&mut context.pool(), &activity_id).await?;
 
   let sensitive = activity.sensitive;
   if !activity.local {