aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/main/java/com/juick')
-rw-r--r--juick-server/src/main/java/com/juick/server/ActivityPubManager.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/juick-server/src/main/java/com/juick/server/ActivityPubManager.java b/juick-server/src/main/java/com/juick/server/ActivityPubManager.java
index 1005b0772..1ffd376b5 100644
--- a/juick-server/src/main/java/com/juick/server/ActivityPubManager.java
+++ b/juick-server/src/main/java/com/juick/server/ActivityPubManager.java
@@ -33,8 +33,10 @@ import java.io.Writer;
import java.net.URI;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.stream.Collectors;
@Component
@@ -133,7 +135,13 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
String userUri = personUri(user);
Note note = makeNote(msg);
Person me = (Person) signatureManager.getContext(URI.create(userUri)).get();
- socialService.getFollowers(user).forEach(acct -> {
+ Set<String> subscribers = new HashSet<>(socialService.getFollowers(user));
+ if (MessageUtils.isReply(msg) && msg.getTo().getUri().toASCIIString().length() > 0) {
+ String replier = msg.getTo().getUri().toASCIIString();
+ subscribers.add(replier);
+ note.getCc().add(replier);
+ }
+ subscribers.forEach(acct -> {
Optional<Context> context = signatureManager.getContext(URI.create(acct));
if (context.isPresent()) {
Person follower = (Person)context.get();
@@ -143,7 +151,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
create.setPublished(note.getPublished());
create.setObject(note);
try {
- logger.info("Posting to follower {}", follower.getId());
+ logger.info("Posting to subscriber {}", follower.getId());
signatureManager.post(me, follower, create);
} catch (IOException e) {
logger.warn("activitypub exception", e);