aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server/api/activity
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/server/api/activity')
-rw-r--r--src/main/java/com/juick/server/api/activity/Profile.java17
1 files changed, 13 insertions, 4 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 d8a8fd90..5a2a766e 100644
--- a/src/main/java/com/juick/server/api/activity/Profile.java
+++ b/src/main/java/com/juick/server/api/activity/Profile.java
@@ -14,6 +14,7 @@ import com.juick.server.api.activity.model.activities.Announce;
import com.juick.server.api.activity.model.activities.Create;
import com.juick.server.api.activity.model.activities.Delete;
import com.juick.server.api.activity.model.activities.Follow;
+import com.juick.server.api.activity.model.activities.Like;
import com.juick.server.api.activity.model.activities.Undo;
import com.juick.server.api.activity.model.objects.Image;
import com.juick.server.api.activity.model.objects.Key;
@@ -304,8 +305,7 @@ public class Profile {
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("-", "/");
+ String postId = activityPubManager.postId(inReplyTo);
User user = new User();
user.setUri(URI.create(activity.getActor()));
String attachment = StringUtils.EMPTY;
@@ -355,8 +355,17 @@ public class Profile {
return new ResponseEntity<>(HttpStatus.OK);
}
}
- if (activity instanceof Announce) {
- logger.info("Announce: {}", jsonMapper.writeValueAsString(activity));
+ if (activity instanceof Like || activity instanceof Announce) {
+ String msgUri = (String)activity.getObject();
+ User user = new User();
+ user.setUri(URI.create(activity.getActor()));
+ Person person = (Person) signatureManager.getContext(user.getUri()).get();
+ user.setName(person.getPreferredUsername());
+ String[] ids = msgUri.split("\\/", 2);
+ if (ids.length == 1) {
+ // only messages
+ commandsManager.processCommand(user, String.format("! #%s", ids[0]), URI.create(StringUtils.EMPTY));
+ }
return new ResponseEntity<>(HttpStatus.OK);
}
logger.warn("Unknown activity: {}", jsonMapper.writeValueAsString(activity));