aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/server/api
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-04-06 13:21:03 +0300
committerGravatar Vitaly Takmazov2018-04-06 13:21:03 +0300
commitfa698d98e0f24362fe55800ca6a431ada213a78d (patch)
treef55551a09f8bf606b900af820043d25c4ec26197 /juick-server/src/main/java/com/juick/server/api
parent7fc4e305e546f30340b8b6a72426723163e91858 (diff)
server: CommandsManager does not depend on Jid
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/api')
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Post.java11
1 files changed, 6 insertions, 5 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 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());
}
}