Mark shown posts and replies known.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / ViewPostPage.java
index 3f3dadc..3bc3b36 100644 (file)
@@ -18,6 +18,7 @@
 package net.pterodactylus.sone.web;
 
 import net.pterodactylus.sone.data.Post;
+import net.pterodactylus.sone.data.Reply;
 import net.pterodactylus.util.template.Template;
 
 /**
@@ -50,8 +51,20 @@ public class ViewPostPage extends SoneTemplatePage {
        protected void processTemplate(Request request, Template template) throws RedirectException {
                super.processTemplate(request, template);
                String postId = request.getHttpRequest().getParam("post");
-               Post post = webInterface.core().getPost(postId);
+               Post post = webInterface.getCore().getPost(postId);
                template.set("post", post);
        }
 
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       protected void postProcess(Request request, Template template) {
+               Post post = (Post) template.get("post");
+               webInterface.getCore().markPostKnown(post);
+               for (Reply reply : webInterface.getCore().getReplies(post)) {
+                       webInterface.getCore().markReplyKnown(reply);
+               }
+       }
+
 }