Fixing name, and check_person_block

This commit is contained in:
Dessalines 2021-08-11 13:33:47 -04:00
parent 84288d7ad4
commit 3ccd860f51
2 changed files with 5 additions and 5 deletions

View file

@ -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());
}

View file

@ -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 {