X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FDeletePostPage.kt;h=c7931cf2d50176cf785c1d2618d761ecf716af43;hp=99ccb3a88ddeee83d277890f2e5d644f00722eee;hb=05fb821e72072bde52f383bdc5a988da67f66d0c;hpb=f0c1becb30b360bf414ca9cbdd5df61490a9393c diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeletePostPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeletePostPage.kt index 99ccb3a..c7931cf 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeletePostPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeletePostPage.kt @@ -14,9 +14,9 @@ class DeletePostPage(template: Template, webInterface: WebInterface): SoneTemplatePage("deletePost.html", template, "Page.DeletePost.Title", webInterface, true) { override fun handleRequest(request: FreenetRequest, templateContext: TemplateContext) { - val post = webInterface.core.getPost(request.httpRequest.getPartAsStringFailsafe("post", 36)).orNull() ?: throw RedirectException("noPermission.html") - val returnPage = request.httpRequest.getPartAsStringFailsafe("returnPage", 256) if (request.isPOST) { + val post = webInterface.core.getPost(request.httpRequest.getPartAsStringFailsafe("post", 36)).orNull() ?: throw RedirectException("noPermission.html") + val returnPage = request.httpRequest.getPartAsStringFailsafe("returnPage", 256) if (!post.sone.isLocal) { throw RedirectException("noPermission.html") } @@ -26,9 +26,12 @@ class DeletePostPage(template: Template, webInterface: WebInterface): } else if (request.httpRequest.isPartSet("abortDelete")) { throw RedirectException(returnPage) } + templateContext["post"] = post + templateContext["returnPage"] = returnPage + return } - templateContext["post"] = post - templateContext["returnPage"] = returnPage + templateContext["post"] = webInterface.core.getPost(request.httpRequest.getParam("post")).orNull() ?: throw RedirectException("noPermission.html") + templateContext["returnPage"] = request.httpRequest.getParam("returnPage") } }