aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-04-24 22:35:12 +0300
committerGravatar Vitaly Takmazov2018-04-24 22:35:12 +0300
commit003ff7221782c4f0cf4a5660832e40c7ac386618 (patch)
tree091a77e710501677a175fe3f86c8290b4bd7d50c /juick-server/src/main/java/com
parent473c9dcec4ff03baf9940bc980371692e369ead2 (diff)
server: count parameter for /react
Diffstat (limited to 'juick-server/src/main/java/com')
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Post.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/juick-server/src/main/java/com/juick/server/api/Post.java b/juick-server/src/main/java/com/juick/server/api/Post.java
index 3b022aae..486e9c0f 100644
--- a/juick-server/src/main/java/com/juick/server/api/Post.java
+++ b/juick-server/src/main/java/com/juick/server/api/Post.java
@@ -263,7 +263,8 @@ public class Post {
@PostMapping("/react")
@ResponseStatus(value = HttpStatus.OK)
- public Status doPostReact(@RequestParam Integer mid,@RequestParam @NotNull int reactionId){
+ public Status doPostReact(@RequestParam Integer mid,@RequestParam @NotNull int reactionId,
+ @RequestParam (required = false, defaultValue = "1") int count) {
logger.info("got reaction with type: {}", reactionId);
com.juick.User visitor = UserUtils.getCurrentUser();
@@ -277,9 +278,10 @@ public class Post {
if (msg.getUser().getUid() == visitor.getUid()) {
throw new HttpForbiddenException();
}
-
- MessagesService.RecommendStatus recommendStatus = messagesService.likeMessage(mid,visitor.getUid(),
- reactionId);
+ MessagesService.RecommendStatus recommendStatus = MessagesService.RecommendStatus.Error;
+ for (int i = 0; i < count; i++)
+ recommendStatus = messagesService.likeMessage(mid, visitor.getUid(),
+ reactionId);
return recommendStatus == MessagesService.RecommendStatus.Error ? Status.ERROR :Status.OK;
}