From 9b201b07dc6caa147ea79b359e448f2649353039 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 25 Feb 2018 09:04:17 +0300 Subject: xmpp: recommend command --- .../src/main/java/com/juick/www/controllers/NewMessage.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'juick-www/src/main/java/com/juick/www/controllers') diff --git a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java index a252bb69..531babd2 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java +++ b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java @@ -310,9 +310,9 @@ public class NewMessage { throw new HttpForbiddenException(); } - boolean res = messagesService.recommendMessage(mid, visitor.getUid()); + MessagesService.RecommendStatus res = messagesService.recommendMessage(mid, visitor.getUid()); - if (res) { + if (res == MessagesService.RecommendStatus.Added) { if (xmpp.isConnected()) { Message xmsg = new Message(); xmsg.setFrom(Jid.of("juick@juick.com")); @@ -325,11 +325,10 @@ public class NewMessage { } else { logger.warn("XMPP unavailable"); } - - return Status.OK; - } else { + } else if (res == MessagesService.RecommendStatus.Error) { throw new HttpBadRequestException(); } + return Status.OK; } @PostMapping("/pm/send") public String doPostPM(@RequestParam(name = "uname", required = false) String unameParam, -- cgit v1.2.3