From 3ccd860f514cc9feaf049417156051cd3adeae97 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 11 Aug 2021 13:33:47 -0400 Subject: [PATCH] Fixing name, and check_person_block --- crates/api/src/local_user.rs | 6 +++--- crates/api_common/src/lib.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) 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 {