diff options
Diffstat (limited to 'juick-server/src')
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)))); } } |