diff options
author | Vitaly Takmazov | 2021-08-23 15:04:09 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2021-08-23 15:04:09 +0300 |
commit | a44510ff17ac6e099ceed9401a62d6d66366c73d (patch) | |
tree | e69576a1f74d43c9b778d66d0aa357316087a8f0 /src/main/java/com/juick/ActivityPubManager.java | |
parent | f7ebc8831b032196e6695fa22647717a7bf2b55c (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.java | 23 |
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; |