X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FDeleteReplyPage.kt;h=e6fbce88d411853cd9c6f6772ed13cb6ca9b4d20;hp=77f7bee277bf335bef505ec4d2b2809360a932ab;hb=HEAD;hpb=2e6be6f2fb6afede009dacc48b8e3318e30e5057 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPage.kt index 77f7bee..e6fbce8 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPage.kt @@ -12,23 +12,24 @@ import javax.inject.* * This page lets the user delete a reply. */ @TemplatePath("/templates/deleteReply.html") +@ToadletPath("deleteReply.html") class DeleteReplyPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : - LoggedInPage("deleteReply.html", "Page.DeleteReply.Title", webInterface, loaders, templateRenderer) { + LoggedInPage("Page.DeleteReply.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { val replyId = soneRequest.httpRequest.getPartAsStringFailsafe("reply", 36) - val reply = soneRequest.core.getPostReply(replyId) ?: throw RedirectException("noPermission.html") + val reply = soneRequest.core.getPostReply(replyId) ?: redirectTo("noPermission.html") if (!reply.sone.isLocal) { - throw RedirectException("noPermission.html") + redirectTo("noPermission.html") } val returnPage = soneRequest.httpRequest.getPartAsStringFailsafe("returnPage", 256) if (soneRequest.httpRequest.isPartSet("confirmDelete")) { soneRequest.core.deleteReply(reply) - throw RedirectException(returnPage) + redirectTo(returnPage) } if (soneRequest.httpRequest.isPartSet("abortDelete")) { - throw RedirectException(returnPage) + redirectTo(returnPage) } templateContext["reply"] = replyId templateContext["returnPage"] = returnPage