X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FSearchPage.java;h=1d1aa36fb000af61694efca75475a1f83acc4914;hb=e3395d9dd51f56240e4cb9509ccd403bf5f9e343;hp=73673abed1e6ba0ce2579ff32c1091511b5f7af3;hpb=9d341071d7fc10118038e238d29ce7bd38ff08c4;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/SearchPage.java b/src/main/java/net/pterodactylus/sone/web/SearchPage.java index 73673ab..1d1aa36 100644 --- a/src/main/java/net/pterodactylus/sone/web/SearchPage.java +++ b/src/main/java/net/pterodactylus/sone/web/SearchPage.java @@ -86,7 +86,7 @@ public class SearchPage extends SoneTemplatePage { posts.addAll(sone.getPosts()); } @SuppressWarnings("synthetic-access") - Set> postHits = getHits(posts, phrases, new PostStringGenerator()); + Set> postHits = getHits(Filters.filteredSet(posts, Post.FUTURE_POSTS_FILTER), phrases, new PostStringGenerator()); /* now filter. */ soneHits = Filters.filteredSet(soneHits, Hit.POSITIVE_FILTER); @@ -103,24 +103,13 @@ public class SearchPage extends SoneTemplatePage { List resultPosts = Converters.convertList(sortedPostHits, new HitConverter()); /* pagination. */ - Pagination sonePagination = new Pagination(resultSones, 10).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("sonePage"), 0)); - Pagination postPagination = new Pagination(resultPosts, 10).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("postPage"), 0)); + Pagination sonePagination = new Pagination(resultSones, webInterface.getCore().getPreferences().getPostsPerPage()).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("sonePage"), 0)); + Pagination postPagination = new Pagination(resultPosts, webInterface.getCore().getPreferences().getPostsPerPage()).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("postPage"), 0)); templateContext.set("sonePagination", sonePagination); templateContext.set("soneHits", sonePagination.getItems()); templateContext.set("postPagination", postPagination); templateContext.set("postHits", postPagination.getItems()); - - /* mark found posts and Sones as knew. */ - for (Sone sone : sonePagination.getItems()) { - webInterface.getCore().markSoneKnown(sone); - } - for (Post post : postPagination.getItems()) { - webInterface.getCore().markPostKnown(post); - for (Reply reply : webInterface.getCore().getReplies(post)) { - webInterface.getCore().markReplyKnown(reply); - } - } } // @@ -329,7 +318,7 @@ public class SearchPage extends SoneTemplatePage { if (post.getRecipient() != null) { postString.append(' ').append(SoneStringGenerator.NAME_GENERATOR.generateString(post.getRecipient())); } - for (Reply reply : webInterface.getCore().getReplies(post)) { + for (Reply reply : Filters.filteredList(webInterface.getCore().getReplies(post), Reply.FUTURE_REPLIES_FILTER)) { postString.append(' ').append(SoneStringGenerator.NAME_GENERATOR.generateString(reply.getSone())); postString.append(' ').append(reply.getText()); }