]> Untitled Git - lemmy.git/blobdiff - crates/apub/src/activities/create_or_update/post.rs
Make functions work with both connection and pool (#3420)
[lemmy.git] / crates / apub / src / activities / create_or_update / post.rs
index 7d5ce33659bd9705fdd65b32932d1d6693a892a1..e0ce0fec4cc48a85e8bfdada8cb1a0c77c17d2e7 100644 (file)
@@ -109,8 +109,10 @@ impl CreateOrUpdatePage {
   ) -> Result<(), LemmyError> {
     let post = ApubPost(post.clone());
     let community_id = post.community_id;
-    let person: ApubPerson = Person::read(context.pool(), person_id).await?.into();
-    let community: ApubCommunity = Community::read(context.pool(), community_id).await?.into();
+    let person: ApubPerson = Person::read(&mut context.pool(), person_id).await?.into();
+    let community: ApubCommunity = Community::read(&mut context.pool(), community_id)
+      .await?
+      .into();
 
     let create_or_update =
       CreateOrUpdatePage::new(post, &person, &community, kind, context).await?;
@@ -187,10 +189,10 @@ impl ActivityHandler for CreateOrUpdatePage {
       person_id: post.creator_id,
       score: 1,
     };
-    PostLike::like(context.pool(), &like_form).await?;
+    PostLike::like(&mut context.pool(), &like_form).await?;
 
     // Calculate initial hot_rank for post
-    PostAggregates::update_hot_rank(context.pool(), post.id).await?;
+    PostAggregates::update_hot_rank(&mut context.pool(), post.id).await?;
 
     Ok(())
   }