aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/ActivityPubManager.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2021-08-23 15:04:09 +0300
committerGravatar Vitaly Takmazov2021-08-23 15:04:09 +0300
commita44510ff17ac6e099ceed9401a62d6d66366c73d (patch)
treee69576a1f74d43c9b778d66d0aa357316087a8f0 /src/main/java/com/juick/ActivityPubManager.java
parentf7ebc8831b032196e6695fa22647717a7bf2b55c (diff)
ActivityPub: send Update event on user profile updates
Diffstat (limited to 'src/main/java/com/juick/ActivityPubManager.java')
-rw-r--r--src/main/java/com/juick/ActivityPubManager.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/java/com/juick/ActivityPubManager.java b/src/main/java/com/juick/ActivityPubManager.java
index cb4d0b54..1e97a54e 100644
--- a/src/main/java/com/juick/ActivityPubManager.java
+++ b/src/main/java/com/juick/ActivityPubManager.java
@@ -217,6 +217,29 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
}
}
}
+
+ @Override
+ public void processUpdateUserEvent(UpdateUserEvent event) {
+ User user = event.getUser();
+ String userUri = personUri(user);
+ Person me = (Person) signatureManager.getContext(URI.create(userUri)).get();
+ socialService.getFollowers(user).forEach(acct -> {
+ try {
+ Person follower = (Person) signatureManager.getContext(URI.create(acct)).orElseThrow();
+ Update update = new Update();
+ update.setId(userUri + "#update");
+ update.setActor(me.getId());
+ update.setObject(new Context(userUri));
+ logger.info("Update to follower {}", follower.getId());
+ signatureManager.post(me, follower, update);
+ } catch (NoSuchElementException e) {
+ logger.warn("Person not verified: {}", acct);
+ } catch (IOException | NoSuchAlgorithmException e) {
+ logger.warn("activitypub exception", e);
+ }
+ });
+ }
+
private void processMessage(Message msg) {
if (MessageUtils.isPM(msg) || msg.isService()) {
return;