From 003ff7221782c4f0cf4a5660832e40c7ac386618 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 24 Apr 2018 22:35:12 +0300 Subject: server: count parameter for /react --- juick-server/src/main/java/com/juick/server/api/Post.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'juick-server/src/main/java/com/juick') 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; } -- cgit v1.2.3