package net.pterodactylus.sone.web;
-import com.google.common.base.Optional;
-
import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.web.page.FreenetRequest;
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateContext;
import net.pterodactylus.util.web.Method;
+import com.google.common.base.Optional;
+
/**
* Lets the user delete a post they made.
*
// TEMPLATEPAGE METHODS
//
- /**
- * {@inheritDoc}
- */
@Override
protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
super.processTemplate(request, templateContext);
if (request.getMethod() == Method.GET) {
String postId = request.getHttpRequest().getParam("post");
String returnPage = request.getHttpRequest().getParam("returnPage");
- Optional<Post> post = webInterface.getCore().getPost(postId);
+ Optional<Post> post = webInterface.getCore().getDatabase().getPost(postId);
if (!post.isPresent()) {
throw new RedirectException("noPermission.html");
}
} else if (request.getMethod() == Method.POST) {
String postId = request.getHttpRequest().getPartAsStringFailsafe("post", 36);
String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256);
- Optional<Post> post = webInterface.getCore().getPost(postId);
+ Optional<Post> post = webInterface.getCore().getDatabase().getPost(postId);
if (!post.isPresent() || !post.get().getSone().isLocal()) {
throw new RedirectException("noPermission.html");
}