aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-10-06 21:56:50 +0300
committerGravatar Vitaly Takmazov2018-10-06 21:56:50 +0300
commit344cad5f852e12fca7076538dd2c5ab8c303449a (patch)
treed7fc9f96ede7608bfa26a413cede932cb35e86ef /juick-server/src/main/java/com
parent48508ed03cbb0c12986b60b84a7667c0955b145d (diff)
log reply command response
Diffstat (limited to 'juick-server/src/main/java/com')
-rw-r--r--juick-server/src/main/java/com/juick/server/api/activity/Profile.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java
index 873f0cea..03f6b538 100644
--- a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java
+++ b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java
@@ -3,6 +3,7 @@ package com.juick.server.api.activity;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.juick.User;
+import com.juick.model.CommandResult;
import com.juick.server.ActivityPubManager;
import com.juick.server.CommandsManager;
import com.juick.server.KeystoreManager;
@@ -286,8 +287,13 @@ public class Profile {
String postId = uri.getPath().substring(uri.getPath().lastIndexOf('/') + 1).replace("-", "/");
User user = new User();
user.setUri(URI.create(activity.getActor()));
- commandsManager.processCommand(user, String.format("#%s %s", postId, note.getContent()), URI.create(note.getAttachment().getUrl()));
- return new ResponseEntity<>(HttpStatus.OK);
+ CommandResult result = commandsManager.processCommand(user, String.format("#%s %s", postId, note.getContent()), URI.create(note.getAttachment().getUrl()));
+ logger.info(jsonMapper.writeValueAsString(result));
+ if (result.getNewMessage().isPresent()) {
+ return new ResponseEntity<>(HttpStatus.OK);
+ } else {
+ return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
+ }
}
}