Clearer check block.

fix_blocking_bug
Dessalines 2021-12-03 21:37:51 -05:00
parent 4a1ceeac01
commit 948a6a37cb
1 changed files with 13 additions and 13 deletions

View File

@ -237,13 +237,13 @@ pub async fn send_local_notifs(
// Get the parent commenter local_user // Get the parent commenter local_user
let parent_creator_id = parent_comment.creator_id; let parent_creator_id = parent_comment.creator_id;
// Don't send a notif to yourself // Only add to recipients if that person isn't blocked
if parent_comment.creator_id != person.id let creator_blocked = check_person_block(person.id, parent_creator_id, context.pool())
// And only add to recipients if that person isn't blocked
&& check_person_block(person.id, parent_creator_id, context.pool())
.await .await
.is_ok() .is_err();
{
// Don't send a notif to yourself
if parent_comment.creator_id != person.id && !creator_blocked {
let user_view = blocking(context.pool(), move |conn| { let user_view = blocking(context.pool(), move |conn| {
LocalUserView::read_person(conn, parent_creator_id) LocalUserView::read_person(conn, parent_creator_id)
}) })
@ -265,14 +265,14 @@ pub async fn send_local_notifs(
} }
} }
// Its a post // Its a post
None => {
// Don't send a notif to yourself // Don't send a notif to yourself
if post.creator_id != person.id None => {
// And only add to recipients if that person isn't blocked // Only add to recipients if that person isn't blocked
&& check_person_block(person.id, post.creator_id, context.pool()) let creator_blocked = check_person_block(person.id, post.creator_id, context.pool())
.await .await
.is_ok() .is_err();
{
if post.creator_id != person.id && !creator_blocked {
let creator_id = post.creator_id; let creator_id = post.creator_id;
let parent_user = blocking(context.pool(), move |conn| { let parent_user = blocking(context.pool(), move |conn| {
LocalUserView::read_person(conn, creator_id) LocalUserView::read_person(conn, creator_id)