mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-06-09 19:47:39 +08:00
Delete notifications when posts or comments are removed
This commit is contained in:
@@ -143,7 +143,7 @@ public class CommentService {
|
|||||||
}
|
}
|
||||||
reactionRepository.findByComment(comment).forEach(reactionRepository::delete);
|
reactionRepository.findByComment(comment).forEach(reactionRepository::delete);
|
||||||
commentSubscriptionRepository.findByComment(comment).forEach(commentSubscriptionRepository::delete);
|
commentSubscriptionRepository.findByComment(comment).forEach(commentSubscriptionRepository::delete);
|
||||||
notificationRepository.findByComment(comment).forEach(n -> { n.setComment(null); notificationRepository.save(n); });
|
notificationRepository.deleteAll(notificationRepository.findByComment(comment));
|
||||||
commentRepository.delete(comment);
|
commentRepository.delete(comment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ public class PostService {
|
|||||||
}
|
}
|
||||||
reactionRepository.findByPost(post).forEach(reactionRepository::delete);
|
reactionRepository.findByPost(post).forEach(reactionRepository::delete);
|
||||||
postSubscriptionRepository.findByPost(post).forEach(postSubscriptionRepository::delete);
|
postSubscriptionRepository.findByPost(post).forEach(postSubscriptionRepository::delete);
|
||||||
notificationRepository.findByPost(post).forEach(n -> { n.setPost(null); notificationRepository.save(n); });
|
notificationRepository.deleteAll(notificationRepository.findByPost(post));
|
||||||
postRepository.delete(post);
|
postRepository.delete(post);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user