From c7145b18652e9a4264910853133e7bf29559cdc5 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 11 Sep 2018 09:33:05 +0300 Subject: ActivityStreams: cc in Note, last in OCP --- .../src/main/java/com/juick/server/api/activity/Profile.java | 7 ++++--- .../main/java/com/juick/server/api/activity/model/Note.java | 9 +++++++++ .../juick/server/api/activity/model/OrderedCollectionPage.java | 10 ++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) (limited to 'juick-server') 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 to; + private List cc; public String getContent() { return content; @@ -39,4 +40,12 @@ public class Note extends ActivityObject { public void setTo(List to) { this.to = to; } + + public List getCc() { + return cc; + } + + public void setCc(List 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 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; + } } -- cgit v1.2.3