X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FDeleteReplyPage.java;h=6052cbb5367dfec800912c656cb69c3209b405ba;hb=00d6cb2688d8dda20ce55d71825b4446701a3a7a;hp=25a9e0b9f74f988cac3568cc7f50634fe2470c82;hpb=3b751d0c053450961bb66d2507d6187ce56f8785;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java b/src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java index 25a9e0b..6052cbb 100644 --- a/src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java +++ b/src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java @@ -17,12 +17,15 @@ package net.pterodactylus.sone.web; +import net.pterodactylus.sone.data.IdBuilder; import net.pterodactylus.sone.data.PostReply; 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; + /** * This page lets the user delete a reply. * @@ -50,17 +53,16 @@ public class DeleteReplyPage extends SoneTemplatePage { * {@inheritDoc} */ @Override - protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException { - super.processTemplate(request, templateContext); - String replyId = request.getHttpRequest().getPartAsStringFailsafe("reply", 36); - PostReply reply = webInterface.getCore().getPostReply(replyId); + protected void processSonePage(FreenetRequest request, TemplateContext templateContext) throws RedirectException { + String replyId = request.getHttpRequest().getPartAsStringFailsafe("reply", IdBuilder.ID_STRING_LENGTH); + Optional reply = webInterface.getCore().getPostReply(replyId); String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256); if (request.getMethod() == Method.POST) { - if (!reply.getSone().isLocal()) { + if (!reply.get().getSone().isLocal()) { throw new RedirectException("noPermission.html"); } if (request.getHttpRequest().isPartSet("confirmDelete")) { - webInterface.getCore().deleteReply(reply); + webInterface.getCore().deleteReply(reply.get()); throw new RedirectException(returnPage); } else if (request.getHttpRequest().isPartSet("abortDelete")) { throw new RedirectException(returnPage);