If no current Sone exists, return an error.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / NewPage.java
index 2d4ec55..7973d28 100644 (file)
@@ -32,6 +32,8 @@ import net.pterodactylus.util.number.Numbers;
 import net.pterodactylus.util.template.Template;
 import net.pterodactylus.util.template.TemplateContext;
 
+import com.google.common.collect.Collections2;
+
 /**
  * Page that displays all new posts and replies. The posts are filtered using
  * {@link ListNotificationFilters#filterPosts(java.util.Collection, net.pterodactylus.sone.data.Sone)}
@@ -57,17 +59,14 @@ public class NewPage extends SoneTemplatePage {
        // SONETEMPLATEPAGE METHODS
        //
 
-       /**
-        * {@inheritDoc}
-        */
        @Override
        protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
                super.processTemplate(request, templateContext);
 
                /* collect new elements from notifications. */
                Set<Post> posts = new HashSet<Post>(webInterface.getNewPosts());
-               for (PostReply reply : webInterface.getNewReplies()) {
-                       posts.add(reply.getPost());
+               for (PostReply reply : Collections2.filter(webInterface.getNewReplies(), PostReply.HAS_POST_FILTER)) {
+                       posts.add(reply.getPost().get());
                }
 
                /* filter and sort them. */