diff options
author | Vitaly Takmazov | 2023-04-18 13:36:37 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-04-18 13:36:37 +0300 |
commit | 66801ba91a51c9b7df6d85136d677350d2495b86 (patch) | |
tree | 6ed5b2ee31b5bb3158ae1d3b791a6e284f438465 /src/main/java/com/juick/ActivityPubManager.java | |
parent | 9e34dffdcdeac0057f1bbd36a3978b992f2c4790 (diff) |
ActivityPub compatibility with private posts
Diffstat (limited to 'src/main/java/com/juick/ActivityPubManager.java')
-rw-r--r-- | src/main/java/com/juick/ActivityPubManager.java | 10 |
1 files changed, 7 insertions, 3 deletions
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())) { |