aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2021-09-04 11:53:46 +0300
committerGravatar Vitaly Takmazov2021-09-04 11:53:46 +0300
commit4b795886e1a1d846b02dd09a9fb9cbe12eb43284 (patch)
treefaac134bb9daa858c6d530a439270bb94ba092a6 /src/main/java/com/juick
parent52e0fe4306fe8991bd7dd0f60537ada36357734d (diff)
ActivityPub: forward all likes as Announces
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r--src/main/java/com/juick/ActivityPubManager.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/main/java/com/juick/ActivityPubManager.java b/src/main/java/com/juick/ActivityPubManager.java
index 5b0e8d59..c6f2c3d8 100644
--- a/src/main/java/com/juick/ActivityPubManager.java
+++ b/src/main/java/com/juick/ActivityPubManager.java
@@ -213,9 +213,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
if (type.equals(ActivityType.message)) {
processMessage(systemEvent.getActivity().getMessage());
} else if (type.equals(ActivityType.like)) {
- if (systemEvent.getActivity().getFrom().equals(serviceUser)) {
- processTop(systemEvent.getActivity().getMessage());
- }
+ processLike(systemEvent.getActivity().getFrom(), systemEvent.getActivity().getMessage());
}
}
@@ -403,15 +401,15 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
}
- private void processTop(Message message) {
+ private void processLike(User user, Message message) {
Note note = makeNote(message);
Announce announce = new Announce();
announce.setId(note.getId() + "#top");
- announce.setActor(personUri(serviceUser));
+ announce.setActor(personUri(user));
announce.setTo(Collections.singletonList(Context.ACTIVITYSTREAMS_PUBLIC));
announce.setObject(note);
Actor me = (Actor) signatureManager.getContext(URI.create(announce.getActor())).get();
- socialService.getFollowers(serviceUser).forEach(acct -> {
+ socialService.getFollowers(user).forEach(acct -> {
var follower = signatureManager.getContext(URI.create(acct));
follower.ifPresentOrElse((person) -> {
try {