aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/juick/ActivityPubManager.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/main/java/com/juick/ActivityPubManager.java b/src/main/java/com/juick/ActivityPubManager.java
index 922ab002..5f42028f 100644
--- a/src/main/java/com/juick/ActivityPubManager.java
+++ b/src/main/java/com/juick/ActivityPubManager.java
@@ -203,12 +203,11 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
socialService.getFollowers(user).forEach(acct -> {
var context = activityPubService.get(URI.create(acct));
context.ifPresentOrElse((follower) -> {
- if (follower instanceof Actor) {
- var to = (Actor) follower;
+ if (follower instanceof Actor to) {
try {
activityPubService.post(from, to, activity);
} catch (Exception e) {
- logger.warn("Delivery to {} failed: {}", to, e.getMessage());
+ logger.warn("Delivery to {} failed: {}", to.getId(), e.getMessage());
}
} else {
try {
@@ -258,8 +257,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
if (!acct.equals(profileUriBuilder.followersUri(user))) {
var context = activityPubService.get(URI.create(acct));
context.ifPresentOrElse((follower) -> {
- if (follower instanceof Actor) {
- var to = (Actor) follower;
+ if (follower instanceof Actor to) {
Create create = new Create();
create.setId(note.getId());
create.setActor(me.getId());
@@ -268,7 +266,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
try {
activityPubService.post(me, to, create);
} catch (InterruptedException | IOException | NoSuchAlgorithmException e) {
- logger.warn("Delivery to {} failed: {}", to, e.getMessage());
+ logger.warn("Delivery to {} failed: {}", to.getId(), e.getMessage());
}
} else {
try {