mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-22 06:50:53 +08:00
Merge pull request #190 from nagisa77/codex/remove-notifications-when-deleting-articles
Clean up 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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ public class PostService {
|
||||
}
|
||||
reactionRepository.findByPost(post).forEach(reactionRepository::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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user