aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-09-05 20:10:55 +0300
committerGravatar Vitaly Takmazov2018-09-05 20:10:55 +0300
commit302200828e48932dba38dc36fd41dd23fb6dfc76 (patch)
tree6b7c69357613a6215f66bbef2220b649c220ef1f /juick-server/src
parenta3824917b908ea3e624b863efe9c9ca4a09fdbf1 (diff)
ActivityStreams: Collection first page is uri
Diffstat (limited to 'juick-server/src')
-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/OrderedCollection.java6
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java2
3 files changed, 7 insertions, 16 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 d5b67433..c0dcc3f6 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
@@ -67,10 +67,7 @@ public class Profile {
OrderedCollection blog = new OrderedCollection();
blog.setId(ServletUriComponentsBuilder.fromCurrentRequestUri().toUriString());
blog.setTotalItems(userService.getStatsMessages(user.getUid()));
- Link first = new Link();
- uriComponentsBuilder.path(String.format("/u/%s/blog", userName));
- first.setHref(uriComponentsBuilder.toUriString());
- blog.setFirst(first);
+ blog.setFirst(uriComponentsBuilder.path(String.format("/u/%s/blog", userName)).toUriString());
return blog;
}
throw new HttpNotFoundException();
@@ -131,10 +128,7 @@ public class Profile {
OrderedCollection followers = new OrderedCollection();
followers.setId(ServletUriComponentsBuilder.fromCurrentRequestUri().toUriString());
followers.setTotalItems(userService.getStatsMyReaders(user.getUid()));
- Link first = new Link();
- uriComponentsBuilder.path(String.format("/u/%s/followers", userName));
- first.setHref(uriComponentsBuilder.toUriString());
- followers.setFirst(first);
+ followers.setFirst(uriComponentsBuilder.path(String.format("/u/%s/followers", userName)).toUriString());
return followers;
}
throw new HttpNotFoundException();
@@ -177,10 +171,7 @@ public class Profile {
OrderedCollection following = new OrderedCollection();
following.setId(ServletUriComponentsBuilder.fromCurrentRequestUri().toUriString());
following.setTotalItems(userService.getUserFriends(user.getUid()).size());
- Link first = new Link();
- uriComponentsBuilder.path(String.format("/u/%s/followers", userName));
- first.setHref(uriComponentsBuilder.toUriString());
- following.setFirst(first);
+ following.setFirst(uriComponentsBuilder.path(String.format("/u/%s/followers", userName)).toUriString());
return following;
}
throw new HttpNotFoundException();
diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollection.java b/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollection.java
index d4f6b7c5..90f04de3 100644
--- a/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollection.java
+++ b/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollection.java
@@ -11,13 +11,13 @@ public class OrderedCollection extends ActivityObject {
public void setTotalItems(int totalItems) {
this.totalItems = totalItems;
}
- private Link first;
+ private String first;
- public Link getFirst() {
+ public String getFirst() {
return first;
}
- public void setFirst(Link first) {
+ public void setFirst(String first) {
this.first = first;
}
}
diff --git a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
index a7104931..3f196461 100644
--- a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
@@ -1353,6 +1353,6 @@ public class ServerTests {
mockMvc.perform(get("/u/ugnich/blog").accept(ActivityObject.ACTIVITY_JSON_MEDIA_TYPE))
.andExpect(status().isOk())
.andExpect(jsonPath("$.orderedItems", hasSize(20)))
- .andExpect(jsonPath("$.next.href", is("http://localhost:8080/u/ugnich/blog?before=" + midsPage.get(midsPage.size() - 1))));
+ .andExpect(jsonPath("$.next", is("http://localhost:8080/u/ugnich/blog?before=" + midsPage.get(midsPage.size() - 1))));
}
}