aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/juick/ActivityPubManager.java7
-rw-r--r--src/main/java/com/juick/service/activities/UpdateEvent.java13
-rw-r--r--src/main/java/com/juick/www/api/Post.java2
3 files changed, 12 insertions, 10 deletions
diff --git a/src/main/java/com/juick/ActivityPubManager.java b/src/main/java/com/juick/ActivityPubManager.java
index 4324df11..1fff41fc 100644
--- a/src/main/java/com/juick/ActivityPubManager.java
+++ b/src/main/java/com/juick/ActivityPubManager.java
@@ -161,16 +161,17 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
@Override
public void processUpdateEvent(UpdateEvent event) {
- String objectUri = event.getMessageUri();
+ Message object = event.getMessage();
User user = event.getUser();
Actor me = conversionService.convert(user, Actor.class);
socialService.getFollowers(user).forEach(acct -> {
try {
Actor follower = (Actor) signatureManager.getContext(URI.create(acct)).orElseThrow();
Update update = new Update();
- update.setId(objectUri + "#update");
+ var note = makeNote(object);
+ update.setId(note.getId() + "#update");
update.setActor(me.getId());
- update.setObject(new Context(objectUri));
+ update.setObject(note);
logger.info("Update to follower {}", follower.getId());
signatureManager.post(me, follower, update);
} catch (IOException | NoSuchAlgorithmException e) {
diff --git a/src/main/java/com/juick/service/activities/UpdateEvent.java b/src/main/java/com/juick/service/activities/UpdateEvent.java
index c5cceb24..879d8005 100644
--- a/src/main/java/com/juick/service/activities/UpdateEvent.java
+++ b/src/main/java/com/juick/service/activities/UpdateEvent.java
@@ -17,31 +17,32 @@
package com.juick.service.activities;
+import com.juick.model.Message;
import com.juick.model.User;
import org.springframework.context.ApplicationEvent;
public class UpdateEvent extends ApplicationEvent {
private final User actor;
- private final String messageUri;
+ private final Message message;
/**
* Create a new {@code ApplicationEvent}.
*
* @param source the object on which the event initially occurred or with
* which the event is associated (never {@code null})
* @param actor the event author
- * @param messageUri the object's id
+ * @param message the object
*/
- public UpdateEvent(Object source, User actor, String messageUri) {
+ public UpdateEvent(Object source, User actor, Message message) {
super(source);
this.actor = actor;
- this.messageUri = messageUri;
+ this.message = message;
}
public User getUser() {
return actor;
}
- public String getMessageUri() {
- return messageUri;
+ public Message getMessage() {
+ return message;
}
}
diff --git a/src/main/java/com/juick/www/api/Post.java b/src/main/java/com/juick/www/api/Post.java
index 63c95f2a..c840a590 100644
--- a/src/main/java/com/juick/www/api/Post.java
+++ b/src/main/java/com/juick/www/api/Post.java
@@ -237,7 +237,7 @@ public class Post {
messagesService.getMessage(mid).orElseThrow(IllegalStateException::new)
: messagesService.getReply(mid, rid);
applicationEventPublisher.publishEvent(
- new UpdateEvent(this, author, profileUriBuilder.messageUri(mid, rid)));
+ new UpdateEvent(this, author, result));
return CommandResult.build(result, "Message updated", StringUtils.EMPTY);
}
throw new HttpBadRequestException();