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/api/activity/Profile.java15
-rw-r--r--juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollectionPage.java16
2 files changed, 18 insertions, 13 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 80b8d6da..d5b67433 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
@@ -103,7 +103,8 @@ public class Profile {
Person person = new Person();
person.setName(user.getName());
OrderedCollectionPage page = new OrderedCollectionPage();
- page.setPartOf(uri.replacePath(String.format("/u/%s/blog", userName)).toUriString());
+ page.setPartOf(uri.replacePath(String.format("/u/%s/blog/toc", userName)).toUriString());
+ page.setFirst(uri.replacePath(String.format("/u/%s/blog", userName)).toUriString());
page.setId(ServletUriComponentsBuilder.fromCurrentRequestUri().toUriString());
page.setOrderedItems(notes.stream().map(a -> {
Create create = new Create();
@@ -116,9 +117,7 @@ public class Profile {
}).collect(Collectors.toList()));
int beforeNext = mids.stream().reduce((fst, second) -> second).orElse(0);
if (beforeNext > 0) {
- Link next = new Link();
- next.setHref(uri.queryParam("before", beforeNext).toUriString());
- page.setNext(next);
+ page.setNext(uri.queryParam("before", beforeNext).toUriString());
}
return page;
}
@@ -164,9 +163,7 @@ public class Profile {
}).collect(Collectors.toList()));
boolean hasNext = followers.size() <= 20 * page;
if (hasNext) {
- Link next = new Link();
- next.setHref(uriComponentsBuilder.queryParam("page", page + 1).toUriString());
- result.setNext(next);
+ result.setNext(uriComponentsBuilder.queryParam("page", page + 1).toUriString());
}
return result;
}
@@ -212,9 +209,7 @@ public class Profile {
}).collect(Collectors.toList()));
boolean hasNext = following.size() <= 20 * page;
if (hasNext) {
- Link next = new Link();
- next.setHref(uriComponentsBuilder.queryParam("page", page + 1).toUriString());
- result.setNext(next);
+ result.setNext(uriComponentsBuilder.queryParam("page", page + 1).toUriString());
}
return result;
}
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 a36c6c11..82ae5bf0 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
@@ -6,15 +6,17 @@ public class OrderedCollectionPage extends ActivityObject {
private String partOf;
- private Link next;
+ private String first;
+
+ private String next;
private List<? extends ActivityObject> orderedItems;
- public Link getNext() {
+ public String getNext() {
return next;
}
- public void setNext(Link next) {
+ public void setNext(String next) {
this.next = next;
}
@@ -33,4 +35,12 @@ public class OrderedCollectionPage extends ActivityObject {
public void setPartOf(String partOf) {
this.partOf = partOf;
}
+
+ public String getFirst() {
+ return first;
+ }
+
+ public void setFirst(String first) {
+ this.first = first;
+ }
}