From 66801ba91a51c9b7df6d85136d677350d2495b86 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 18 Apr 2023 13:36:37 +0300 Subject: ActivityPub compatibility with private posts --- src/main/java/com/juick/ActivityPubManager.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/main/java/com/juick/ActivityPubManager.java') diff --git a/src/main/java/com/juick/ActivityPubManager.java b/src/main/java/com/juick/ActivityPubManager.java index 62faccf6..d5ee0b50 100644 --- a/src/main/java/com/juick/ActivityPubManager.java +++ b/src/main/java/com/juick/ActivityPubManager.java @@ -183,7 +183,6 @@ public class ActivityPubManager implements ActivityListener, NotificationListene update.setId(note.getId() + "#update"); update.setActor(me.getId()); update.setObject(note); - update.setTo(Collections.singletonList(Context.ACTIVITYSTREAMS_PUBLIC)); update.setPublished(Instant.now()); logger.info("{} sends note update to followers", me.getId()); activityToFollowers(user, me, update); @@ -313,8 +312,13 @@ public class ActivityPubManager implements ActivityListener, NotificationListene if (MessageUtils.isPM(msg)) { note.setTo(Collections.singletonList(profileUriBuilder.personUri(msg.getTo()))); } else { - note.setTo(Collections.singletonList(Context.ACTIVITYSTREAMS_PUBLIC)); - note.setCc(Collections.singletonList(profileUriBuilder.followersUri(msg.getUser()))); + var followers = Collections.singletonList(profileUriBuilder.followersUri(msg.getUser())); + if (!msg.FriendsOnly) { + note.setTo(Collections.singletonList(Context.ACTIVITYSTREAMS_PUBLIC)); + note.setCc(followers); + } else { + note.setTo(followers); + } } note.setPublished(msg.getCreated()); if (StringUtils.isNotBlank(msg.getAttachmentType())) { -- cgit v1.2.3