]> Untitled Git - lemmy.git/blobdiff - crates/api/src/local_user/block.rs
Make functions work with both connection and pool (#3420)
[lemmy.git] / crates / api / src / local_user / block.rs
index 67b1f521d42f6346bf0776383042cf6aaf5670f9..604219d4e0b6937e2c551e677be4df06e5cb3be7 100644 (file)
@@ -34,18 +34,18 @@ impl Perform for BlockPerson {
       target_id,
     };
 
-    let target_person_view = PersonView::read(context.pool(), target_id).await?;
+    let target_person_view = PersonView::read(&mut context.pool(), target_id).await?;
 
     if target_person_view.person.admin {
       return Err(LemmyErrorType::CantBlockAdmin)?;
     }
 
     if data.block {
-      PersonBlock::block(context.pool(), &person_block_form)
+      PersonBlock::block(&mut context.pool(), &person_block_form)
         .await
         .with_lemmy_type(LemmyErrorType::PersonBlockAlreadyExists)?;
     } else {
-      PersonBlock::unblock(context.pool(), &person_block_form)
+      PersonBlock::unblock(&mut context.pool(), &person_block_form)
         .await
         .with_lemmy_type(LemmyErrorType::PersonBlockAlreadyExists)?;
     }