aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-04-14 17:12:51 +0300
committerGravatar Vitaly Takmazov2022-04-14 17:12:51 +0300
commit055cda0267efd41678cf0dcdbefa7de821b3db23 (patch)
treedd44c151f7a1de7d231b99fdf0cff2efde1efa8c
parentdae1b7cd38fbdae22cdcf79fb9ea09e2ab640255 (diff)
ActivityPub: handle followers exceptions
-rw-r--r--src/main/java/com/juick/ActivityPubManager.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/com/juick/ActivityPubManager.java b/src/main/java/com/juick/ActivityPubManager.java
index b0e77c63..a86fc301 100644
--- a/src/main/java/com/juick/ActivityPubManager.java
+++ b/src/main/java/com/juick/ActivityPubManager.java
@@ -416,11 +416,15 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
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);
+ if (person instanceof Actor) {
+ 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);
+ }
+ } else {
+ logger.warn("Unhandled context: {}", acct);
}
}, () -> logger.warn("Follower not found: {}", acct));
});