Don’t mark elements as known automatically when viewing a page.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / SearchPage.java
index 73673ab..7381f80 100644 (file)
@@ -86,7 +86,7 @@ public class SearchPage extends SoneTemplatePage {
                        posts.addAll(sone.getPosts());
                }
                @SuppressWarnings("synthetic-access")
-               Set<Hit<Post>> postHits = getHits(posts, phrases, new PostStringGenerator());
+               Set<Hit<Post>> postHits = getHits(Filters.filteredSet(posts, Post.FUTURE_POSTS_FILTER), phrases, new PostStringGenerator());
 
                /* now filter. */
                soneHits = Filters.filteredSet(soneHits, Hit.POSITIVE_FILTER);
@@ -110,17 +110,6 @@ public class SearchPage extends SoneTemplatePage {
                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());
                        }