X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FIndexPage.java;h=5f4a4a44bd146bee46b5d6e203bff5611b0ac3d6;hb=73be50df4f7b7761fe7f286f2fdb73a142c14926;hp=2d85e020d32c0aa3934155f858d52983ff6d6cf2;hpb=ecf753a31601e558b681daab0598009fe9eec99a;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/IndexPage.java b/src/main/java/net/pterodactylus/sone/web/IndexPage.java index 2d85e02..5f4a4a4 100644 --- a/src/main/java/net/pterodactylus/sone/web/IndexPage.java +++ b/src/main/java/net/pterodactylus/sone/web/IndexPage.java @@ -25,6 +25,7 @@ import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.data.Reply; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.util.collection.Pagination; +import net.pterodactylus.util.filter.Filters; import net.pterodactylus.util.number.Numbers; import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContext; @@ -73,25 +74,20 @@ public class IndexPage extends SoneTemplatePage { } } } + allPosts = Filters.filteredList(allPosts, Post.FUTURE_POSTS_FILTER); Collections.sort(allPosts, Post.TIME_COMPARATOR); Pagination pagination = new Pagination(allPosts, 25).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("page"), 0)); templateContext.set("pagination", pagination); templateContext.set("posts", pagination.getItems()); - } - /** - * {@inheritDoc} - */ - @Override - protected void postProcess(Request request, TemplateContext templateContext) { - @SuppressWarnings("unchecked") - List posts = (List) templateContext.get("posts"); - for (Post post : posts) { + /* mark it all as known. */ + for (Post post : pagination.getItems()) { webInterface.getCore().markPostKnown(post); for (Reply reply : webInterface.getCore().getReplies(post)) { webInterface.getCore().markReplyKnown(reply); } } + } }