diff --git a/crates/api/src/local_user.rs b/crates/api/src/local_user.rs index 492c8d158..1bd8ac410 100644 --- a/crates/api/src/local_user.rs +++ b/crates/api/src/local_user.rs @@ -491,18 +491,18 @@ impl Perform for BlockPerson { return Err(ApiError::err("cant_block_yourself").into()); } - let community_block_form = PersonBlockForm { + let person_block_form = PersonBlockForm { person_id, recipient_id, }; if data.block { - let block = move |conn: &'_ _| PersonBlock::block(conn, &community_block_form); + let block = move |conn: &'_ _| PersonBlock::block(conn, &person_block_form); if blocking(context.pool(), block).await?.is_err() { return Err(ApiError::err("person_block_already_exists").into()); } } else { - let unblock = move |conn: &'_ _| PersonBlock::unblock(conn, &community_block_form); + let unblock = move |conn: &'_ _| PersonBlock::unblock(conn, &person_block_form); if blocking(context.pool(), unblock).await?.is_err() { return Err(ApiError::err("person_block_already_exists").into()); } diff --git a/crates/api_common/src/lib.rs b/crates/api_common/src/lib.rs index 0421c5970..49798fbac 100644 --- a/crates/api_common/src/lib.rs +++ b/crates/api_common/src/lib.rs @@ -360,8 +360,8 @@ pub async fn check_person_block( recipient_id: PersonId, pool: &DbPool, ) -> Result<(), LemmyError> { - // TODO the person and recipient might be reversed - let is_blocked = move |conn: &'_ _| PersonBlock::read(conn, person_id, recipient_id).is_ok(); + // Flip the recipient and the person + let is_blocked = move |conn: &'_ _| PersonBlock::read(conn, recipient_id, person_id).is_ok(); if blocking(pool, is_blocked).await? { Err(ApiError::err("person_block").into()) } else {