diff options
author | Vitaly Takmazov | 2020-01-31 14:06:51 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2020-01-31 14:06:51 +0300 |
commit | 8eeac22c25fdc83351bcbbb388de2f0e9b28a70f (patch) | |
tree | 00402d9ab7f8c20338b4199ce645dd897e4486d3 /src/main/java | |
parent | c489e05ff4f0e9c8a7bc1ac26728e98dcb305215 (diff) |
ActivityPub: process top event exception
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/juick/server/ActivityPubManager.java | 16 |
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 { |