aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/server')
-rw-r--r--src/main/java/com/juick/server/ActivityPubManager.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/main/java/com/juick/server/ActivityPubManager.java b/src/main/java/com/juick/server/ActivityPubManager.java
index de24985c..5249f3c9 100644
--- a/src/main/java/com/juick/server/ActivityPubManager.java
+++ b/src/main/java/com/juick/server/ActivityPubManager.java
@@ -1,6 +1,7 @@
package com.juick.server;
import com.juick.Message;
+import com.juick.Reaction;
import com.juick.User;
import com.juick.formatters.PlainTextFormatter;
import com.juick.server.api.activity.model.Context;
@@ -137,30 +138,28 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
@Override
public void processAnnounceEvent(AnnounceEvent event) {
- logger.info("Announce: {} -> {}", event.getActorUri(), event.getMessageUri());
UriComponents uriComponents = UriComponentsBuilder.fromUriString(event.getMessageUri()).build();
List<String> segments = uriComponents.getPathSegments();
if (segments.get(0).equals("n")) {
String[] ids = segments.get(1).split("-", 2);
- if (ids.length == 1) {
+ if (ids.length == 2 && Integer.valueOf(ids[1]) == 0) {
// only messages
logger.info("{} recommends {}", event.getActorUri(), Integer.valueOf(ids[0]));
- messagesService.recommendMessage(Integer.valueOf(ids[0]), 0, event.getActorUri());
+ messagesService.likeMessage(Integer.valueOf(ids[0]), 0, Reaction.LIKE, event.getActorUri());
}
}
}
@Override
public void undoAnnounceEvent(UndoAnnounceEvent event) {
- logger.info("Undo announce: {} -> {}", event.getActorUri(), event.getMessageUri());
UriComponents uriComponents = UriComponentsBuilder.fromUriString(event.getMessageUri()).build();
List<String> segments = uriComponents.getPathSegments();
- if (segments.get(0).equals("m")) {
+ if (segments.get(0).equals("n")) {
String[] ids = segments.get(1).split("-", 2);
- if (ids.length == 1) {
+ if (ids.length == 2 && Integer.valueOf(ids[1]) == 0) {
// only messages
logger.info("{} stop recommending {}", event.getActorUri(), Integer.valueOf(ids[0]));
- messagesService.recommendMessage(Integer.valueOf(ids[0]), 0, event.getActorUri());
+ messagesService.likeMessage(Integer.valueOf(ids[0]), 0, null, event.getActorUri());
}
}
}