]> Untitled Git - lemmy.git/blobdiff - crates/api/src/site/purge/comment.rs
Make functions work with both connection and pool (#3420)
[lemmy.git] / crates / api / src / site / purge / comment.rs
index 7beba9c0b41a97b6fc29c615c1bbfce3e982e39d..9334961e981b710f3bd13efb6991ea55e003a875 100644 (file)
@@ -29,13 +29,13 @@ impl Perform for PurgeComment {
     let comment_id = data.comment_id;
 
     // Read the comment to get the post_id
-    let comment = Comment::read(context.pool(), comment_id).await?;
+    let comment = Comment::read(&mut context.pool(), comment_id).await?;
 
     let post_id = comment.post_id;
 
     // TODO read comments for pictrs images and purge them
 
-    Comment::delete(context.pool(), comment_id).await?;
+    Comment::delete(&mut context.pool(), comment_id).await?;
 
     // Mod tables
     let reason = data.reason.clone();
@@ -45,7 +45,7 @@ impl Perform for PurgeComment {
       post_id,
     };
 
-    AdminPurgeComment::create(context.pool(), &form).await?;
+    AdminPurgeComment::create(&mut context.pool(), &form).await?;
 
     Ok(PurgeItemResponse { success: true })
   }