From 344cad5f852e12fca7076538dd2c5ab8c303449a Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 6 Oct 2018 21:56:50 +0300 Subject: log reply command response --- .../src/main/java/com/juick/server/api/activity/Profile.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'juick-server/src/main') 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); + } } } -- cgit v1.2.3