diff options
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r-- | src/main/java/com/juick/www/api/activity/Profile.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/main/java/com/juick/www/api/activity/Profile.java b/src/main/java/com/juick/www/api/activity/Profile.java index 2ba9b0a05..4dcd4910f 100644 --- a/src/main/java/com/juick/www/api/activity/Profile.java +++ b/src/main/java/com/juick/www/api/activity/Profile.java @@ -385,15 +385,20 @@ public class Profile { } if (activity.getObject() instanceof Note) { Note note = (Note) activity.getObject(); + logger.info("Got update to {}", note.getId()); if (activity.getActor().equals(note.getAttributedTo())) { - Message reply = messagesService.getReplyByUri(activity.getObject().getUrl()); - if (messagesService.updateMessage(reply.getMid(), reply.getRid(), formatNote(note), true)) { - logger.info("{} update they message {}", activity.getActor(), note.getId()); - return new ResponseEntity<>(HttpStatus.ACCEPTED); + Message reply = messagesService.getReplyByUri(note.getId()); + if (reply != null) { + if (messagesService.updateMessage(reply.getMid(), reply.getRid(), formatNote(note), true)) { + logger.info("{} update they message {}", activity.getActor(), note.getId()); + return new ResponseEntity<>(HttpStatus.ACCEPTED); + } + logger.warn("Unable to update {}", note.getId()); + return new ResponseEntity<>(HttpStatus.SERVICE_UNAVAILABLE); + } else { + logger.warn("Update not found: {}", note.getId()); + return new ResponseEntity<>(HttpStatus.NOT_FOUND); } - ; - logger.warn("Unable to update {}", activity.getObject().getId()); - return new ResponseEntity<>(HttpStatus.SERVICE_UNAVAILABLE); } else { logger.warn("Invalid Update: {}", jsonMapper.writeValueAsString(activity)); return new ResponseEntity<>(HttpStatus.BAD_REQUEST); |