diff --git a/crates/core/src/database/messages.rs b/crates/core/src/database/messages.rs index 98378bc..e1b013d 100644 --- a/crates/core/src/database/messages.rs +++ b/crates/core/src/database/messages.rs @@ -147,6 +147,17 @@ impl DataManager { ua.to_owned() } else { let user = self.get_user_by_username(&username).await?; + + // check blocked status + if self + .get_userblock_by_initiator_receiver(user.id, data.owner) + .await + .is_ok() + { + return Err(Error::NotAllowed); + } + + // create notif self.create_notification(Notification::new( "You've been mentioned in a message!".to_string(), format!( @@ -156,6 +167,8 @@ impl DataManager { user.id, )) .await?; + + // ... already_notified.insert(username.to_owned(), user.clone()); user } diff --git a/crates/core/src/database/posts.rs b/crates/core/src/database/posts.rs index c0d6063..9c70817 100644 --- a/crates/core/src/database/posts.rs +++ b/crates/core/src/database/posts.rs @@ -860,6 +860,17 @@ impl DataManager { ua.to_owned() } else { let user = self.get_user_by_username(&username).await?; + + // check blocked status + if self + .get_userblock_by_initiator_receiver(user.id, data.owner) + .await + .is_ok() + { + return Err(Error::NotAllowed); + } + + // send notif self.create_notification(Notification::new( "You've been mentioned in a post!".to_string(), format!( @@ -869,6 +880,8 @@ impl DataManager { user.id, )) .await?; + + // ... already_notified.insert(username.to_owned(), user.clone()); user }