aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2020-01-31 14:06:51 +0300
committerGravatar Vitaly Takmazov2020-01-31 14:06:51 +0300
commit8eeac22c25fdc83351bcbbb388de2f0e9b28a70f (patch)
tree00402d9ab7f8c20338b4199ce645dd897e4486d3 /src/main/java
parentc489e05ff4f0e9c8a7bc1ac26728e98dcb305215 (diff)
ActivityPub: process top event exception
Diffstat (limited to 'src/main/java')
-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 {