diff options
-rw-r--r-- | src/main/java/com/juick/server/api/activity/Profile.java | 4 | ||||
-rw-r--r-- | src/test/java/com/juick/server/tests/ServerTests.java | 2 | ||||
-rw-r--r-- | src/test/resources/announce.json (renamed from src/test/resources/note_document.json) | 0 |
3 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/juick/server/api/activity/Profile.java b/src/main/java/com/juick/server/api/activity/Profile.java index c26941ef..f5d8025c 100644 --- a/src/main/java/com/juick/server/api/activity/Profile.java +++ b/src/main/java/com/juick/server/api/activity/Profile.java @@ -361,7 +361,9 @@ public class Profile { } } if (activity instanceof Like || activity instanceof Announce) { - applicationEventPublisher.publishEvent(new AnnounceEvent(this, activity.getActor(), (String)activity.getObject())); + String messageUri = activity.getObject() instanceof String ? (String) activity.getObject() + : ((Context) activity.getObject()).getId(); + applicationEventPublisher.publishEvent(new AnnounceEvent(this, activity.getActor(), messageUri)); return new ResponseEntity<>(CommandResult.fromString("Like/announce request accepted"), HttpStatus.OK); } logger.warn("Unknown activity: {}", jsonMapper.writeValueAsString(activity)); diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index a4b3f95c..9569c45d 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -211,7 +211,7 @@ public class ServerTests { private Resource nojfif; @Value("classpath:hubzilla_activity.json") private Resource hubzillaActivity; - @Value("classpath:note_document.json") + @Value("classpath:announce.json") private Resource noteWithDocument; @Inject diff --git a/src/test/resources/note_document.json b/src/test/resources/announce.json index 4ae4a2ad..4ae4a2ad 100644 --- a/src/test/resources/note_document.json +++ b/src/test/resources/announce.json |