diff --git a/crates/core/src/database/posts.rs b/crates/core/src/database/posts.rs index 0d3f6dd..0e76fa1 100644 --- a/crates/core/src/database/posts.rs +++ b/crates/core/src/database/posts.rs @@ -1793,15 +1793,26 @@ impl DataManager { // send notification if data.owner != rt.owner { let owner = self.get_user_by_id(data.owner).await?; - self.create_notification(Notification::new( - "Your post has received a new comment!".to_string(), - format!( - "[@{}](/api/v1/auth/user/find/{}) has commented on your [post](/post/{}).", - owner.username, owner.id, rt.id - ), - rt.owner, - )) - .await?; + + // make sure we're actually following the person we're commenting to + // we shouldn't send the notif if we aren't, because they can't see it + // (only if our profile is private) + if !owner.settings.private_profile + | self + .get_userfollow_by_initiator_receiver(data.owner, rt.owner) + .await + .is_ok() + { + self.create_notification(Notification::new( + "Your post has received a new comment!".to_string(), + format!( + "[@{}](/api/v1/auth/user/find/{}) has commented on your [post](/post/{}).", + owner.username, owner.id, rt.id + ), + rt.owner, + )) + .await?; + } if !rt.context.comments_enabled { return Err(Error::NotAllowed);