@Transactional
@With(AnonymousCheckAction.class)
@IsAllowed(Operation.READ)
public static Result unvoteComment(String user, String project, Long number, Long commentId) {
IssueComment issueComment = IssueComment.find.byId(commentId);
if (issueComment == null) {
return notFound("issue.comment.error.unvote");
}
if (!issueComment.voters.contains(UserApp.currentUser())) {
return notFound("issue.comment.error.have.not.voted");
}
issueComment.removeVoter(UserApp.currentUser());
return redirect(RouteUtil.getUrl(issueComment));
}