fixes+improvements

This commit is contained in:
2021-10-03 20:23:26 +02:00
parent 0842b1dfb8
commit 6d6f21d4f2
5 changed files with 155 additions and 18 deletions
@@ -182,4 +182,28 @@ public class CommentManager {
return upvotes - downvotes;
}
/**
*
* @param comment
*/
public void delete(Comment comment) {
for (Comment subcomment : commentRepository.findAll(qComment.parent.eq(comment.getId()))) {
delete(subcomment);
}
voteManager.deleteByTarget(comment.getId(), Types.comment);
commentRepository.delete(comment);
}
/**
*
* @param target
*/
public void deleteByTarget(Long target) {
for (Comment comment : commentRepository.findAll(qComment.target.eq(target))) {
delete(comment);
}
}
}