fixes+improvements
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user