diff --git a/crates/api_common/src/lib.rs b/crates/api_common/src/lib.rs index 49798fbac..e7d5181bc 100644 --- a/crates/api_common/src/lib.rs +++ b/crates/api_common/src/lib.rs @@ -356,12 +356,11 @@ pub async fn check_community_ban( } pub async fn check_person_block( - person_id: PersonId, - recipient_id: PersonId, + my_id: PersonId, + potential_blocker_id: PersonId, pool: &DbPool, ) -> Result<(), LemmyError> { - // Flip the recipient and the person - let is_blocked = move |conn: &'_ _| PersonBlock::read(conn, recipient_id, person_id).is_ok(); + let is_blocked = move |conn: &'_ _| PersonBlock::read(conn, potential_blocker_id, my_id).is_ok(); if blocking(pool, is_blocked).await? { Err(ApiError::err("person_block").into()) } else { diff --git a/crates/db_queries/src/source/community_block.rs b/crates/db_queries/src/source/community_block.rs index 368ec70e2..346e7f3ac 100644 --- a/crates/db_queries/src/source/community_block.rs +++ b/crates/db_queries/src/source/community_block.rs @@ -4,7 +4,7 @@ use lemmy_db_schema::source::community_block::{CommunityBlock, CommunityBlockFor impl Blockable for CommunityBlock { type Form = CommunityBlockForm; - fn block(conn: &PgConnection, community_block_form: &CommunityBlockForm) -> Result { + fn block(conn: &PgConnection, community_block_form: &Self::Form) -> Result { use lemmy_db_schema::schema::community_block::dsl::*; insert_into(community_block) .values(community_block_form) @@ -13,10 +13,7 @@ impl Blockable for CommunityBlock { .set(community_block_form) .get_result::(conn) } - fn unblock( - conn: &PgConnection, - community_block_form: &CommunityBlockForm, - ) -> Result { + fn unblock(conn: &PgConnection, community_block_form: &Self::Form) -> Result { use lemmy_db_schema::schema::community_block::dsl::*; diesel::delete( community_block diff --git a/crates/db_queries/src/source/person_block.rs b/crates/db_queries/src/source/person_block.rs index e4a60096d..50af971b8 100644 --- a/crates/db_queries/src/source/person_block.rs +++ b/crates/db_queries/src/source/person_block.rs @@ -38,7 +38,7 @@ impl Blockable for PersonBlock { .set(person_block_form) .get_result::(conn) } - fn unblock(conn: &PgConnection, person_block_form: &PersonBlockForm) -> Result { + fn unblock(conn: &PgConnection, person_block_form: &Self::Form) -> Result { use lemmy_db_schema::schema::person_block::dsl::*; diesel::delete( person_block