if (!tmpl.isSessionAuthorized()) {
throw new AccessViolationException("нет авторизации");
}
User user = tmpl.getCurrentUser();
user.checkBlocked();
user.checkAnonymous();
Comment comment = commentService.getById(msgid);
if (comment.isDeleted()) {
throw new UserErrorException("комментарий уже удален");
}
Topic topic = messageDao.getById(comment.getTopicId());
final boolean haveAnswers = commentService.isHaveAnswers(comment);
if (!permissionService.isCommentDeletableNow(comment, user, topic, haveAnswers)) {
throw new UserErrorException("комментарий нельзя удалить");
}
if (!user.isModerator() || comment.getUserid() == user.getId()) {
bonus = 0;
}
List<Integer> deleted;
if (user.isModerator()) {
deleted = commentService.deleteWithReplys(topic, comment, reason, user, bonus);
} else {
if (commentService.deleteComment(msgid, reason, user)) {
deleted = ImmutableList.of(msgid);
} else {