mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-26 14:21:19 +00:00
Fixing name, and check_person_block
This commit is contained in:
parent
84288d7ad4
commit
3ccd860f51
2 changed files with 5 additions and 5 deletions
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue