aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/main/java/com/juick')
-rw-r--r--juick-server/src/main/java/com/juick/server/api/activity/Profile.java8
-rw-r--r--juick-server/src/main/java/com/juick/server/api/activity/model/Create.java11
-rw-r--r--juick-server/src/main/java/com/juick/server/api/activity/model/Note.java11
3 files changed, 29 insertions, 1 deletions
diff --git a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java
index 8072e0d3..a0804d2c 100644
--- a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java
+++ b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java
@@ -17,6 +17,7 @@ import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import org.springframework.web.util.UriComponentsBuilder;
import javax.inject.Inject;
+import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -81,11 +82,15 @@ public class Profile {
User user = userService.getUserByName(userName);
if (!user.isAnonymous()) {
UriComponentsBuilder uri = UriComponentsBuilder.fromUriString(baseUri);
- uri.path(String.format("/u/%s/blog", userName));
+ String blogUri = uri.path(String.format("/u/%s/blog/toc", userName)).toUriString();
+ String followersUri = uri.path(String.format("/u/%s/followers/toc", userName)).toUriString();
List<Integer> mids = messagesService.getUserBlog(user.getUid(), 0, before);
List<Note> notes = messagesService.getMessages(visitor, mids).stream().map(m -> {
Note note = new Note();
note.setId(uri.replacePath(String.format("/m/%d", m.getMid())).toUriString());
+ note.setAttributedTo(blogUri);
+ note.setTo(Arrays.asList(followersUri,
+ "https://www.w3.org/ns/activitystreams#Public"));
note.setPublished(m.getTimestamp());
note.setContent(MessageUtils.formatMessage(m.getText()));
if (StringUtils.isNotBlank(m.getAttachmentType())) {
@@ -103,6 +108,7 @@ public class Profile {
page.setOrderedItems(notes.stream().map(a -> {
Create create = new Create();
create.setId(a.getId() + "#Create");
+ create.setTo(a.getTo());
create.setActor(person);
create.setObject(a);
create.setPublished(a.getPublished());
diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/Create.java b/juick-server/src/main/java/com/juick/server/api/activity/model/Create.java
index 8d81b26b..60ad4ae3 100644
--- a/juick-server/src/main/java/com/juick/server/api/activity/model/Create.java
+++ b/juick-server/src/main/java/com/juick/server/api/activity/model/Create.java
@@ -1,9 +1,12 @@
package com.juick.server.api.activity.model;
+import java.util.List;
+
public class Create extends ActivityObject {
private Person actor;
private Note object;
+ private List<String> to;
public Person getActor() {
return actor;
@@ -20,4 +23,12 @@ public class Create extends ActivityObject {
public void setObject(Note object) {
this.object = object;
}
+
+ public List<String> getTo() {
+ return to;
+ }
+
+ public void setTo(List<String> to) {
+ this.to = to;
+ }
}
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 ae799f5e..8a34c926 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,9 +1,12 @@
package com.juick.server.api.activity.model;
+import java.util.List;
+
public class Note extends ActivityObject {
private String content;
private String attributedTo;
private Link attachment;
+ private List<String> to;
public String getContent() {
return content;
@@ -28,4 +31,12 @@ public class Note extends ActivityObject {
public void setAttachment(Link attachment) {
this.attachment = attachment;
}
+
+ public List<String> getTo() {
+ return to;
+ }
+
+ public void setTo(List<String> to) {
+ this.to = to;
+ }
}