aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r--src/main/java/com/juick/server/ActivityPubManager.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/main/java/com/juick/server/ActivityPubManager.java b/src/main/java/com/juick/server/ActivityPubManager.java
index 18470b16..6053695a 100644
--- a/src/main/java/com/juick/server/ActivityPubManager.java
+++ b/src/main/java/com/juick/server/ActivityPubManager.java
@@ -382,13 +382,15 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
announce.setObject(note);
Person me = (Person) signatureManager.getContext(URI.create(announce.getActor())).get();
socialService.getFollowers(serviceUser).forEach(acct -> {
- Person follower = (Person) signatureManager.getContext(URI.create(acct)).get();
- try {
- logger.info("Announcing top: {}", message.getMid());
- signatureManager.post(me, follower, announce);
- } catch (IOException e) {
- logger.warn("activitypub exception", e);
- }
+ var follower = signatureManager.getContext(URI.create(acct));
+ follower.ifPresentOrElse((person) -> {
+ try {
+ logger.info("Announcing top: {}", message.getMid());
+ signatureManager.post(me, (Person)person, announce);
+ } catch (IOException e) {
+ logger.warn("activitypub exception", e);
+ }
+ }, () -> logger.warn("Follower not found: {}", acct));
});
}
public User personToUser(URI uri) throws HttpBadRequestException {