aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-10-06 22:17:13 +0300
committerGravatar Vitaly Takmazov2018-10-06 22:17:13 +0300
commit217a8423866ccbf54e3fd9269b104c23a3713f47 (patch)
tree3fbf95e4799159c5ec5ea9f903d65d8916f16170 /juick-server/src/main/java
parent344cad5f852e12fca7076538dd2c5ab8c303449a (diff)
fix Note deserialization
Diffstat (limited to 'juick-server/src/main/java')
-rw-r--r--juick-server/src/main/java/com/juick/server/api/activity/Profile.java10
1 files changed, 6 insertions, 4 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 03f6b538..a8019341 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
@@ -278,16 +278,18 @@ public class Profile {
}
}
if (activity instanceof Create) {
- if (activity.getObject() instanceof Note) {
- Note note = (Note) activity.getObject();
- String inReplyTo = note.getInReplyTo();
+ if (activity.getObject() instanceof Map) {
+ Map<String, Object> note = (Map<String, Object>) activity.getObject();
+ String inReplyTo = (String)note.get("inReplyTo");
if (StringUtils.isNotBlank(inReplyTo)) {
if (inReplyTo.startsWith(baseUri)) {
UriComponents uri = UriComponentsBuilder.fromUriString(inReplyTo).build();
String postId = uri.getPath().substring(uri.getPath().lastIndexOf('/') + 1).replace("-", "/");
User user = new User();
user.setUri(URI.create(activity.getActor()));
- CommandResult result = commandsManager.processCommand(user, String.format("#%s %s", postId, note.getContent()), URI.create(note.getAttachment().getUrl()));
+ Map<String, Object> attachmentObj = (Map<String, Object> )((List<Object>) note.get("attachment")).get(0);
+ String attachment = attachmentObj != null ? (String)attachmentObj.get("url") : StringUtils.EMPTY;
+ CommandResult result = commandsManager.processCommand(user, String.format("#%s %s", postId, note.get("content")), URI.create(attachment));
logger.info(jsonMapper.writeValueAsString(result));
if (result.getNewMessage().isPresent()) {
return new ResponseEntity<>(HttpStatus.OK);