X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FNewPage.java;h=7973d2890b26b6089d83c2cc97cbdc1efc7d8df9;hb=2e03e9dddbea4b81aacaf1aa316f5c3ccffd4bf9;hp=9ea9e7530d1df82a006c5cba7ce5856e1df356a4;hpb=62708ebefffaaba161ac707899108a7c25a26179;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/NewPage.java b/src/main/java/net/pterodactylus/sone/web/NewPage.java index 9ea9e75..7973d28 100644 --- a/src/main/java/net/pterodactylus/sone/web/NewPage.java +++ b/src/main/java/net/pterodactylus/sone/web/NewPage.java @@ -1,5 +1,5 @@ /* - * Sone - NewPage.java - Copyright © 2012 David Roden + * Sone - NewPage.java - Copyright © 2013 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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 posts = new HashSet(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. */