X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FDeleteReplyPage.java;h=4d6aff2861ac57425cbed603f4b0dae490909a71;hb=a88e930a23b550dae75116d7759924d760941776;hp=00a1a0eb72a10590e85c5a54b766ca5fa6d37773;hpb=952e56e8a89eb706d8ff5e2f652c165b646a06f3;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 00a1a0e..4d6aff2 100644 --- a/src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java +++ b/src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java @@ -1,5 +1,5 @@ /* - * Sone - DeleteReplyPage.java - Copyright © 2010 David Roden + * Sone - DeleteReplyPage.java - Copyright © 2010–2012 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,10 +17,11 @@ package net.pterodactylus.sone.web; -import net.pterodactylus.sone.data.Reply; -import net.pterodactylus.sone.data.Sone; -import net.pterodactylus.sone.web.page.Page.Request.Method; +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; /** * This page lets the user delete a reply. @@ -49,14 +50,13 @@ public class DeleteReplyPage extends SoneTemplatePage { * {@inheritDoc} */ @Override - protected void processTemplate(Request request, Template template) throws RedirectException { - super.processTemplate(request, template); + protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException { + super.processTemplate(request, templateContext); String replyId = request.getHttpRequest().getPartAsStringFailsafe("reply", 36); - Reply reply = webInterface.getCore().getReply(replyId); + PostReply reply = webInterface.getCore().getPostReply(replyId, false); String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256); if (request.getMethod() == Method.POST) { - Sone currentSone = getCurrentSone(request.getToadletContext()); - if (!reply.getSone().equals(currentSone)) { + if (!reply.getSone().isLocal()) { throw new RedirectException("noPermission.html"); } if (request.getHttpRequest().isPartSet("confirmDelete")) { @@ -66,8 +66,8 @@ public class DeleteReplyPage extends SoneTemplatePage { throw new RedirectException(returnPage); } } - template.set("reply", reply); - template.set("returnPage", returnPage); + templateContext.set("reply", reply); + templateContext.set("returnPage", returnPage); } }