X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FViewSonePage.java;h=d933bc7f36e6382591710a635cc4d6184f29fee6;hb=533720edfdc8c59088db00fef5374c6a8f461a1a;hp=ba69eed025f34c165d07784e89414a36aa0426d8;hpb=fb35fd7f5f4aa4e830f6767eefbc564e4254e017;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 ba69eed..d933bc7 100644 --- a/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java +++ b/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java @@ -17,6 +17,10 @@ package net.pterodactylus.sone.web; +import java.util.List; + +import net.pterodactylus.sone.data.Post; +import net.pterodactylus.sone.data.Reply; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.util.template.Template; @@ -36,7 +40,7 @@ public class ViewSonePage extends SoneTemplatePage { * The Sone web interface */ public ViewSonePage(Template template, WebInterface webInterface) { - super("viewSone.html", template, "Page.ViewSone.Title", webInterface); + super("viewSone.html", template, "Page.ViewSone.Title", webInterface, false); } // @@ -50,8 +54,23 @@ public class ViewSonePage extends SoneTemplatePage { protected void processTemplate(Request request, Template template) throws RedirectException { super.processTemplate(request, template); String soneId = request.getHttpRequest().getParam("sone"); - Sone sone = webInterface.core().getSone(soneId); + Sone sone = webInterface.getCore().getSone(soneId, false); template.set("sone", sone); } + /** + * {@inheritDoc} + */ + @Override + protected void postProcess(Request request, Template template) { + Sone sone = (Sone) template.get("sone"); + List posts = sone.getPosts(); + for (Post post : posts) { + webInterface.getCore().markPostKnown(post); + for (Reply reply : webInterface.getCore().getReplies(post)) { + webInterface.getCore().markReplyKnown(reply); + } + } + } + }