};
use lemmy_api_common::{
blocking,
+ check_person_block,
comment::CommentResponse,
community::CommunityResponse,
person::PrivateMessageResponse,
let parent_comment =
blocking(context.pool(), move |conn| Comment::read(conn, parent_id)).await?;
if let Ok(parent_comment) = parent_comment {
+ // 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 {
- // Get the parent commenter local_user
+ if parent_comment.creator_id != person.id && !creator_blocked {
let user_view = blocking(context.pool(), move |conn| {
- LocalUserView::read_person(conn, parent_comment.creator_id)
+ LocalUserView::read_person(conn, parent_creator_id)
})
.await?;
if let Ok(parent_user_view) = user_view {
}
}
// Its a post
+ // Don't send a notif to yourself
None => {
- if post.creator_id != person.id {
+ // 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)