aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/server
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/main/java/com/juick/server')
-rw-r--r--juick-server/src/main/java/com/juick/server/ActivityPubManager.java12
-rw-r--r--juick-server/src/main/java/com/juick/server/api/activity/model/Note.java14
2 files changed, 19 insertions, 7 deletions
diff --git a/juick-server/src/main/java/com/juick/server/ActivityPubManager.java b/juick-server/src/main/java/com/juick/server/ActivityPubManager.java
index ded04313..223d28fd 100644
--- a/juick-server/src/main/java/com/juick/server/ActivityPubManager.java
+++ b/juick-server/src/main/java/com/juick/server/ActivityPubManager.java
@@ -114,8 +114,16 @@ public class ActivityPubManager implements ApplicationListener<FollowEvent>, Not
Note note = new Note();
note.setId(uri.replacePath(String.format("/m/%d", msg.getMid())).toUriString());
note.setAttributedTo(personUri(msg.getUser()));
- note.setTo(Collections.singletonList("https://www.w3.org/ns/activitystreams#Public"));
- note.setCc(Collections.singletonList(followersUri(msg.getUser())));
+ if (MessageUtils.isReply(msg)) {
+ uri.replacePath(String.format("/m/%d#%d", msg.getMid(), msg.getRid())).toUriString();
+ note.setInReplyTo(uri.replacePath(String.format("/m/%d#%d", msg.getMid(), msg.getReplyto())).toUriString());
+ }
+ if (MessageUtils.isPM(msg)) {
+ note.setTo(Collections.singletonList(activityPubManager.personUri(msg.getTo())));
+ } else {
+ note.setTo(Collections.singletonList("https://www.w3.org/ns/activitystreams#Public"));
+ note.setCc(Collections.singletonList(followersUri(msg.getUser())));
+ }
note.setPublished(msg.getTimestamp());
note.setContent(MessageUtils.formatMessage(msg.getText()));
if (StringUtils.isNotBlank(msg.getAttachmentType())) {
diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/Note.java b/juick-server/src/main/java/com/juick/server/api/activity/model/Note.java
index c15cd8d3..61a64f8d 100644
--- a/juick-server/src/main/java/com/juick/server/api/activity/model/Note.java
+++ b/juick-server/src/main/java/com/juick/server/api/activity/model/Note.java
@@ -1,15 +1,11 @@
package com.juick.server.api.activity.model;
-import com.juick.Message;
-import com.juick.util.MessageUtils;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.Collections;
import java.util.List;
public class Note extends Context {
private String content;
private String attributedTo;
+ private String inReplyTo;
private Link attachment;
private List<String> to;
private List<String> cc;
@@ -53,4 +49,12 @@ public class Note extends Context {
public void setCc(List<String> cc) {
this.cc = cc;
}
+
+ public String getInReplyTo() {
+ return inReplyTo;
+ }
+
+ public void setInReplyTo(String inReplyTo) {
+ this.inReplyTo = inReplyTo;
+ }
}