aboutsummaryrefslogtreecommitdiff
path: root/juick-server
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-09-11 09:33:05 +0300
committerGravatar Vitaly Takmazov2018-09-11 09:33:05 +0300
commitc7145b18652e9a4264910853133e7bf29559cdc5 (patch)
treeb5be385f65015368bb7069d492dce67d583fb832 /juick-server
parent1fcef1974368b4b06cade3834156a92b819a15c1 (diff)
ActivityStreams: cc in Note, last in OCP
Diffstat (limited to 'juick-server')
-rw-r--r--juick-server/src/main/java/com/juick/server/api/activity/Profile.java7
-rw-r--r--juick-server/src/main/java/com/juick/server/api/activity/model/Note.java9
-rw-r--r--juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollectionPage.java10
3 files changed, 23 insertions, 3 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 06735117..a06987da 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
@@ -18,7 +18,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.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -94,8 +94,8 @@ public class Profile {
Note note = new Note();
note.setId(uri.replacePath(String.format("/m/%d", m.getMid())).toUriString());
note.setAttributedTo(personUri);
- note.setTo(Arrays.asList(followersUri,
- "https://www.w3.org/ns/activitystreams#Public"));
+ note.setTo(Collections.singletonList("https://www.w3.org/ns/activitystreams#Public"));
+ note.setCc(Collections.singletonList(followersUri));
note.setPublished(m.getTimestamp());
note.setContent(MessageUtils.formatMessage(m.getText()));
if (StringUtils.isNotBlank(m.getAttachmentType())) {
@@ -124,6 +124,7 @@ public class Profile {
if (beforeNext > 0) {
page.setNext(uri.queryParam("before", beforeNext).toUriString());
}
+ page.setLast(uri.replaceQueryParam("before", "1").toUriString());
return (OrderedCollectionPage) ActivityObject.build(page);
}
throw new HttpNotFoundException();
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 8a34c926..ac58b033 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
@@ -7,6 +7,7 @@ public class Note extends ActivityObject {
private String attributedTo;
private Link attachment;
private List<String> to;
+ private List<String> cc;
public String getContent() {
return content;
@@ -39,4 +40,12 @@ public class Note extends ActivityObject {
public void setTo(List<String> to) {
this.to = to;
}
+
+ public List<String> getCc() {
+ return cc;
+ }
+
+ public void setCc(List<String> cc) {
+ this.cc = cc;
+ }
}
diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollectionPage.java b/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollectionPage.java
index 82ae5bf0..af7f2cec 100644
--- a/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollectionPage.java
+++ b/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollectionPage.java
@@ -10,6 +10,8 @@ public class OrderedCollectionPage extends ActivityObject {
private String next;
+ private String last;
+
private List<? extends ActivityObject> orderedItems;
public String getNext() {
@@ -43,4 +45,12 @@ public class OrderedCollectionPage extends ActivityObject {
public void setFirst(String first) {
this.first = first;
}
+
+ public String getLast() {
+ return last;
+ }
+
+ public void setLast(String last) {
+ this.last = last;
+ }
}