package net.pterodactylus.sone.web;
import net.pterodactylus.sone.data.Post;
+import net.pterodactylus.sone.data.Reply;
+import net.pterodactylus.util.template.DataProvider;
import net.pterodactylus.util.template.Template;
/**
* The Sone web interface
*/
public ViewPostPage(Template template, WebInterface webInterface) {
- super("viewPost.html", template, "Page.ViewPost.Title", webInterface);
+ super("viewPost.html", template, "Page.ViewPost.Title", webInterface, false);
}
//
* {@inheritDoc}
*/
@Override
- protected void processTemplate(Request request, Template template) throws RedirectException {
- super.processTemplate(request, template);
+ protected void processTemplate(Request request, DataProvider dataProvider) throws RedirectException {
+ super.processTemplate(request, dataProvider);
String postId = request.getHttpRequest().getParam("post");
- Post post = webInterface.core().getPost(postId);
- template.set("post", post);
+ Post post = webInterface.getCore().getPost(postId);
+ dataProvider.set("post", post);
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
/**
* {@inheritDoc}
*/
@Override
- protected boolean requiresLogin() {
- return true;
+ protected void postProcess(Request request, DataProvider dataProvider) {
+ Post post = (Post) dataProvider.get("post");
+ webInterface.getCore().markPostKnown(post);
+ for (Reply reply : webInterface.getCore().getReplies(post)) {
+ webInterface.getCore().markReplyKnown(reply);
+ }
}
}