]> Untitled Git - lemmy.git/blobdiff - crates/api_crud/src/comment/update.rs
Make functions work with both connection and pool (#3420)
[lemmy.git] / crates / api_crud / src / comment / update.rs
index 7b37d900430f4086a6d5e8cd792d73c629dbf731..0129e87c2e50ea99183924e815cb3c3a22aa273d 100644 (file)
@@ -33,15 +33,15 @@ impl PerformCrud for EditComment {
   async fn perform(&self, context: &Data<LemmyContext>) -> Result<CommentResponse, LemmyError> {
     let data: &EditComment = self;
     let local_user_view = local_user_view_from_jwt(&data.auth, context).await?;
-    let local_site = LocalSite::read(context.pool()).await?;
+    let local_site = LocalSite::read(&mut context.pool()).await?;
 
     let comment_id = data.comment_id;
-    let orig_comment = CommentView::read(context.pool(), comment_id, None).await?;
+    let orig_comment = CommentView::read(&mut context.pool(), comment_id, None).await?;
 
     check_community_ban(
       local_user_view.person.id,
       orig_comment.community.id,
-      context.pool(),
+      &mut context.pool(),
     )
     .await?;
 
@@ -52,7 +52,7 @@ impl PerformCrud for EditComment {
 
     let language_id = self.language_id;
     CommunityLanguage::is_allowed_community_language(
-      context.pool(),
+      &mut context.pool(),
       language_id,
       orig_comment.community.id,
     )
@@ -72,7 +72,7 @@ impl PerformCrud for EditComment {
       .language_id(data.language_id)
       .updated(Some(Some(naive_now())))
       .build();
-    let updated_comment = Comment::update(context.pool(), comment_id, &form)
+    let updated_comment = Comment::update(&mut context.pool(), comment_id, &form)
       .await
       .with_lemmy_type(LemmyErrorType::CouldntUpdateComment)?;