fix: don't send notif when a user you've blocked likes your post

fix: don't allow users you've blocked to add you to a chat
This commit is contained in:
trisua 2025-05-04 16:42:17 -04:00
parent e727de9c63
commit 2fa5a4dc1f
2 changed files with 28 additions and 9 deletions

View file

@ -130,6 +130,18 @@ impl DataManager {
return Err(Error::NotAllowed); return Err(Error::NotAllowed);
} }
} }
// check members
else {
for member in &data.members {
if self
.get_userblock_by_initiator_receiver(member.to_owned(), data.owner)
.await
.is_ok()
{
return Err(Error::NotAllowed);
}
}
}
// ... // ...
let conn = match self.connect().await { let conn = match self.connect().await {

View file

@ -125,6 +125,12 @@ impl DataManager {
let post = self.get_post_by_id(data.asset).await.unwrap(); let post = self.get_post_by_id(data.asset).await.unwrap();
if post.owner != user.id { if post.owner != user.id {
// check block status (don't send notif if blocked)
if self
.get_userblock_by_initiator_receiver(post.owner, user.id)
.await
.is_err()
{
self.create_notification(Notification::new( self.create_notification(Notification::new(
"Your post has received a like!".to_string(), "Your post has received a like!".to_string(),
format!( format!(
@ -137,6 +143,7 @@ impl DataManager {
} }
} }
} }
}
AssetType::Question => { AssetType::Question => {
if let Err(e) = { if let Err(e) = {
if data.is_like { if data.is_like {