change voting
This commit is contained in:
@@ -112,25 +112,27 @@ public class CommentManager {
|
||||
}
|
||||
if (!comment.getMetadata().containsKey("points")) {
|
||||
comment.getMetadata().put("points",
|
||||
voteManager.getPoints(comment.getId(), Types.entry));
|
||||
voteManager.getPoints(comment.getId(), Types.comment));
|
||||
}
|
||||
if (!comment.getMetadata().containsKey("vote")) {
|
||||
comment.getMetadata().put("vote",
|
||||
!voteRepository.exists(qVote.target.eq(comment.getId())
|
||||
|
||||
if (!comment.getMetadata().containsKey("upvoted")) {
|
||||
comment.getMetadata().put("upvoted",
|
||||
voteRepository.exists(qVote.target.eq(comment.getId())
|
||||
.and(qVote.targetType.eq(Types.comment)).and(qVote.type.eq(VoteType.up))
|
||||
.and(qVote.author.eq(username))));
|
||||
}
|
||||
if (!comment.getMetadata().containsKey("unvote")) {
|
||||
comment.getMetadata().put("unvote",
|
||||
|
||||
if (!comment.getMetadata().containsKey("downvoted")) {
|
||||
comment.getMetadata().put("downvoted",
|
||||
voteRepository.exists(qVote.target.eq(comment.getId())
|
||||
.and(qVote.targetType.eq(Types.comment))
|
||||
.and(qVote.type.eq(VoteType.up).and(qVote.author.eq(username)))));
|
||||
.and(qVote.type.eq(VoteType.down)).and(qVote.author.eq(username))));
|
||||
}
|
||||
if (!comment.getMetadata().containsKey("downvote")) {
|
||||
comment.getMetadata()
|
||||
.put("downvote",
|
||||
!voteRepository.exists(qVote.target.eq(comment.getId())
|
||||
.and(qVote.targetType.eq(Types.comment))
|
||||
|
||||
if (!comment.getMetadata().containsKey("unvote")) {
|
||||
comment.getMetadata().put("unvote",
|
||||
voteRepository.exists(
|
||||
qVote.target.eq(comment.getId()).and(qVote.targetType.eq(Types.comment))
|
||||
.and(qVote.author.eq(username))));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user