fix: don't send comment notif if our profile is private and we aren't following post owner
This commit is contained in:
parent
b7b84d15b7
commit
a43e586e4c
1 changed files with 20 additions and 9 deletions
|
@ -1793,6 +1793,16 @@ impl DataManager {
|
|||
// send notification
|
||||
if data.owner != rt.owner {
|
||||
let owner = self.get_user_by_id(data.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!(
|
||||
|
@ -1802,6 +1812,7 @@ impl DataManager {
|
|||
rt.owner,
|
||||
))
|
||||
.await?;
|
||||
}
|
||||
|
||||
if !rt.context.comments_enabled {
|
||||
return Err(Error::NotAllowed);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue