aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/juick/ActivityPubManager.java29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/main/java/com/juick/ActivityPubManager.java b/src/main/java/com/juick/ActivityPubManager.java
index 621a89c2..b0e77c63 100644
--- a/src/main/java/com/juick/ActivityPubManager.java
+++ b/src/main/java/com/juick/ActivityPubManager.java
@@ -411,17 +411,24 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
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(user).forEach(acct -> {
- var follower = signatureManager.getContext(URI.create(acct));
- follower.ifPresentOrElse((person) -> {
- try {
- logger.info("{} announcing {} to {}", user.getName(), message.getMid(), acct);
- signatureManager.post(me, (Actor)person, announce);
- } catch (IOException | NoSuchAlgorithmException e) {
- logger.warn("activitypub exception", e);
- }
- }, () -> logger.warn("Follower not found: {}", acct));
+ signatureManager.getContext(URI.create(announce.getActor())).ifPresentOrElse((ctx) -> {
+ if (ctx instanceof Actor) {
+ socialService.getFollowers(user).forEach(acct -> {
+ var follower = signatureManager.getContext(URI.create(acct));
+ follower.ifPresentOrElse((person) -> {
+ try {
+ logger.info("{} announcing {} to {}", user.getName(), message.getMid(), acct);
+ signatureManager.post((Actor)ctx, (Actor) person, announce);
+ } catch (IOException | NoSuchAlgorithmException e) {
+ logger.warn("activitypub exception", e);
+ }
+ }, () -> logger.warn("Follower not found: {}", acct));
+ });
+ } else {
+ logger.warn("Unhandled context: {}", announce.getActor());
+ }
+ }, () -> {
+ logger.warn("Context not found: {}", announce.getActor());
});
}
public User actorToUser(URI uri) throws HttpBadRequestException {