aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/ActivityPubManager.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-04-18 13:36:37 +0300
committerGravatar Vitaly Takmazov2023-04-18 13:36:37 +0300
commit66801ba91a51c9b7df6d85136d677350d2495b86 (patch)
tree6ed5b2ee31b5bb3158ae1d3b791a6e284f438465 /src/main/java/com/juick/ActivityPubManager.java
parent9e34dffdcdeac0057f1bbd36a3978b992f2c4790 (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.java10
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())) {