From 4b795886e1a1d846b02dd09a9fb9cbe12eb43284 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 4 Sep 2021 11:53:46 +0300 Subject: ActivityPub: forward all likes as Announces --- src/main/java/com/juick/ActivityPubManager.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') 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 { -- cgit v1.2.3