X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FNewPage.java;h=a00f96c4aabd268324ecbbcf49bb572a64381ed1;hp=411f40fed556023ea5c70f6ad9edaf98fb168fe8;hb=107af8767f5dce8c27fa4c91b3ff3bc951140cca;hpb=de7568a82eb4150bf6d2b0553841b7b69f84c968 diff --git a/src/main/java/net/pterodactylus/sone/web/pages/NewPage.java b/src/main/java/net/pterodactylus/sone/web/pages/NewPage.java index 411f40f..a00f96c 100644 --- a/src/main/java/net/pterodactylus/sone/web/pages/NewPage.java +++ b/src/main/java/net/pterodactylus/sone/web/pages/NewPage.java @@ -29,9 +29,9 @@ import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.data.PostReply; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.notify.PostVisibilityFilter; +import net.pterodactylus.sone.utils.Pagination; import net.pterodactylus.sone.web.WebInterface; import net.pterodactylus.sone.web.page.FreenetRequest; -import net.pterodactylus.util.collection.Pagination; import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContext; @@ -65,8 +65,8 @@ public class NewPage extends SoneTemplatePage { @Override protected void handleRequest(FreenetRequest request, TemplateContext templateContext) throws RedirectException { /* collect new elements from notifications. */ - Set posts = new HashSet(webInterface.getNewPosts(getCurrentSoneWithoutCreatingSession(request.getToadletContext()))); - for (PostReply reply : webInterface.getNewReplies(getCurrentSoneWithoutCreatingSession(request.getToadletContext()))) { + Set posts = new HashSet(webInterface.getNewPosts(getCurrentSone(request.getToadletContext(), false))); + for (PostReply reply : webInterface.getNewReplies(getCurrentSone(request.getToadletContext(), false))) { posts.add(reply.getPost().get()); } @@ -75,7 +75,8 @@ public class NewPage extends SoneTemplatePage { Collections.sort(sortedPosts, Post.NEWEST_FIRST); /* paginate them. */ - Pagination pagination = new Pagination<>(sortedPosts, webInterface.getCore().getPreferences().getPostsPerPage()).setPage(parseInt(request.getHttpRequest().getParam("page"), 0)); + Pagination pagination = new Pagination<>(sortedPosts, webInterface.getCore().getPreferences().getPostsPerPage()); + pagination.setPage(parseInt(request.getHttpRequest().getParam("page"), 0)); templateContext.set("pagination", pagination); templateContext.set("posts", pagination.getItems()); }