X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FViewSonePage.java;h=53702f71d8630271bc5041f1981d81090df8b38b;hb=540d77dbd88133a950ebf240f35557aaf98e272e;hp=758b93d222ea095a209e8fd3c1a27bea3515a78c;hpb=ee05a67b3f1e796b6c4bdcd709ef0983103c455f;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java b/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java index 758b93d..53702f7 100644 --- a/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java +++ b/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java @@ -81,6 +81,8 @@ public class ViewSonePage extends SoneTemplatePage { Sone sone = webInterface.getCore().getSone(soneId, false); templateContext.set("sone", sone); List sonePosts = sone.getPosts(); + sonePosts.addAll(webInterface.getCore().getDirectedPosts(sone)); + Collections.sort(sonePosts, Post.TIME_COMPARATOR); Pagination postPagination = new Pagination(sonePosts, 10).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("postPage"), 0)); templateContext.set("postPagination", postPagination); templateContext.set("posts", postPagination.getItems()); @@ -88,7 +90,7 @@ public class ViewSonePage extends SoneTemplatePage { final Map> repliedPosts = new HashMap>(); for (Reply reply : replies) { Post post = reply.getPost(); - if (repliedPosts.containsKey(post) || sone.equals(post.getSone())) { + if (repliedPosts.containsKey(post) || sone.equals(post.getSone()) || (sone.equals(post.getRecipient()))) { continue; } repliedPosts.put(post, webInterface.getCore().getReplies(post)); @@ -108,27 +110,4 @@ public class ViewSonePage extends SoneTemplatePage { templateContext.set("repliedPosts", repliedPostPagination.getItems()); } - /** - * {@inheritDoc} - */ - @Override - @SuppressWarnings("unchecked") - protected void postProcess(Request request, TemplateContext templateContext) { - Sone sone = (Sone) templateContext.get("sone"); - if (sone == null) { - return; - } - webInterface.getCore().markSoneKnown(sone); - List posts = (List) templateContext.get("posts"); - posts.addAll((List) templateContext.get("repliedPosts")); - for (Post post : posts) { - if (post.getSone() != null) { - webInterface.getCore().markPostKnown(post); - } - for (Reply reply : webInterface.getCore().getReplies(post)) { - webInterface.getCore().markReplyKnown(reply); - } - } - } - }