From 8f96d329454c3343d4177364c12c087bf1147a7d Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 23 Oct 2021 11:10:19 +0300 Subject: Minor code cleanup --- src/main/java/com/juick/ActivityPubManager.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main/java/com/juick/ActivityPubManager.java') diff --git a/src/main/java/com/juick/ActivityPubManager.java b/src/main/java/com/juick/ActivityPubManager.java index 5df89527..621a89c2 100644 --- a/src/main/java/com/juick/ActivityPubManager.java +++ b/src/main/java/com/juick/ActivityPubManager.java @@ -249,7 +249,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene User user = msg.getUser(); String userUri = personUri(user); Note note = makeNote(msg); - Person me = (Person) signatureManager.getContext(URI.create(userUri)).get(); + Actor me = (Actor) signatureManager.getContext(URI.create(userUri)).get(); Set subscribers = new HashSet<>(socialService.getFollowers(user)); if (MessageUtils.isReply(msg) && msg.getTo().getUri().toASCIIString().length() > 0) { String replier = msg.getTo().getUri().toASCIIString(); @@ -261,7 +261,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene subscribers.addAll(note.getCc()); subscribers.forEach(acct -> { Optional context = signatureManager.getContext(URI.create(acct)); - if (context.isPresent() && context.get() instanceof Person) { + if (context.isPresent() && context.get() instanceof Actor) { Actor follower = (Actor)context.get(); Create create = new Create(); create.setId(note.getId()); @@ -359,7 +359,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene Note activity = (Note) noteContext.get(); Optional personContext = signatureManager.getContext(URI.create(activity.getAttributedTo())); if (personContext.isPresent()) { - Person person = (Person) personContext.get(); + Actor person = (Actor) personContext.get(); note.getTags().add(new Mention(person.getUrl(), person.getPreferredUsername())); msg.getTo().setName(person.getPreferredUsername()); note.setInReplyTo(activity.getInReplyTo()); @@ -424,8 +424,8 @@ public class ActivityPubManager implements ActivityListener, NotificationListene }, () -> logger.warn("Follower not found: {}", acct)); }); } - public User personToUser(URI uri) throws HttpBadRequestException { - Person person = (Person) signatureManager.getContext(uri).orElseThrow(HttpBadRequestException::new); + public User actorToUser(URI uri) throws HttpBadRequestException { + Actor person = (Actor) signatureManager.getContext(uri).orElseThrow(HttpBadRequestException::new); User user = new User(); user.setUri(URI.create(person.getId())); user.setName(person.getPreferredUsername()); -- cgit v1.2.3