aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-02-23 21:32:34 +0300
committerGravatar Vitaly Takmazov2019-02-23 21:32:34 +0300
commit0682e5c1a3f71c3bbb23ac646d2a4e54a472ac06 (patch)
tree39a54a3da9652c2ed6526c7ec75262fbf1515afc /src
parentb0898ebd93a6aabdb58be182c3f8e9ac4f0b44b7 (diff)
Announce object may be Context
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/server/api/activity/Profile.java4
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java2
-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