From fa698d98e0f24362fe55800ca6a431ada213a78d Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 6 Apr 2018 13:21:03 +0300 Subject: server: CommandsManager does not depend on Jid --- juick-server/src/main/java/com/juick/server/api/Post.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'juick-server/src/main/java/com/juick/server/api') 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 eddd1dd6..68465de1 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 @@ -106,7 +106,7 @@ public class Post { throw new HttpBadRequestException(); } } - commandsManager.processCommand(visitor, null, body, attachmentFName); + commandsManager.processCommand(visitor, body, attachmentFName); } @PostMapping("/upload") public String doUploadFile(@RequestParam(required = true) MultipartFile attach) { @@ -163,7 +163,7 @@ public class Post { } } - return commandsManager.processCommand(visitor, null, body, attachmentFName).getNewMessage().get(); + return commandsManager.processCommand(visitor, body, attachmentFName).getNewMessage().get(); } Session session = Session.getDefaultInstance(new Properties()); @@ -227,7 +227,7 @@ public class Post { } URI attachmentUri = StringUtils.isNotEmpty(attachmentFName[0]) ? URI.create(String.format("juick://%s", attachmentFName[0])) : URI.create(StringUtils.EMPTY); - commandsManager.processCommand(visitor, null, body[0], attachmentUri); + commandsManager.processCommand(visitor, body[0], attachmentUri); } else { logger.info("not registered: {}", from); } @@ -237,7 +237,7 @@ public class Post { } @PostMapping("/like") @ResponseStatus(value = HttpStatus.OK) - public Status doPostRecomm(@RequestParam Integer mid) { + public Status doPostRecomm(@RequestParam Integer mid) throws Exception { com.juick.User visitor = UserUtils.getCurrentUser(); if (visitor.getUid() == 0) { throw new HttpForbiddenException(); @@ -249,7 +249,8 @@ public class Post { if (msg.getUser().getUid() == visitor.getUid()) { throw new HttpForbiddenException(); } - CommandResult status = commandsManager.commandRecommend(visitor, null, null, String.valueOf(mid)); + CommandResult status = commandsManager.processCommand(visitor, String.format("! #%d", mid), + URI.create(StringUtils.EMPTY)); return Status.getStatus(status.getText()); } } -- cgit v1.2.3