From 948a6a37cb5973b9743504e50926aa81b6375314 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 3 Dec 2021 21:37:51 -0500 Subject: [PATCH] Clearer check block. --- crates/websocket/src/send.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/crates/websocket/src/send.rs b/crates/websocket/src/send.rs index 7a2cc01bf..ac0752c64 100644 --- a/crates/websocket/src/send.rs +++ b/crates/websocket/src/send.rs @@ -237,13 +237,13 @@ pub async fn send_local_notifs( // Get the parent commenter local_user let parent_creator_id = parent_comment.creator_id; + // Only add to recipients if that person isn't blocked + let creator_blocked = check_person_block(person.id, parent_creator_id, context.pool()) + .await + .is_err(); + // Don't send a notif to yourself - if parent_comment.creator_id != person.id - // And only add to recipients if that person isn't blocked - && check_person_block(person.id, parent_creator_id, context.pool()) - .await - .is_ok() - { + if parent_comment.creator_id != person.id && !creator_blocked { let user_view = blocking(context.pool(), move |conn| { LocalUserView::read_person(conn, parent_creator_id) }) @@ -265,14 +265,14 @@ pub async fn send_local_notifs( } } // Its a post + // Don't send a notif to yourself None => { - // Don't send a notif to yourself - if post.creator_id != person.id - // And only add to recipients if that person isn't blocked - && check_person_block(person.id, post.creator_id, context.pool()) - .await - .is_ok() - { + // Only add to recipients if that person isn't blocked + let creator_blocked = check_person_block(person.id, post.creator_id, context.pool()) + .await + .is_err(); + + if post.creator_id != person.id && !creator_blocked { let creator_id = post.creator_id; let parent_user = blocking(context.pool(), move |conn| { LocalUserView::read_person(conn, creator_id)