X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FDeleteSonePage.kt;h=0b0df7dd68749bc17b746242ecf74664100f5b60;hb=6b71175d0493719bfccbf747abfd7cb45a46eaff;hp=786848485a434f815ef218276116e310b1c4648d;hpb=5ba707d40f9d2a20094aaabc21647aeec1feed46;p=Sone.git diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt index 7868484..0b0df7d 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt @@ -1,23 +1,25 @@ package net.pterodactylus.sone.web.pages +import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.FreenetRequest import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext +import javax.inject.Inject /** * Lets the user delete a Sone. Of course the Sone is not really deleted from * Freenet; merely all references to it are removed from the local plugin * installation. */ -class DeleteSonePage(template: Template, webInterface: WebInterface): - SoneTemplatePage("deleteSone.html", template, "Page.DeleteSone.Title", webInterface, true) { +class DeleteSonePage @Inject constructor(template: Template, webInterface: WebInterface): + LoggedInPage("deleteSone.html", template, "Page.DeleteSone.Title", webInterface) { - override fun handleRequest(request: FreenetRequest, templateContext: TemplateContext) { - if (request.isPOST) { - if (request.httpRequest.isPartSet("deleteSone")) { - webInterface.core.deleteSone(getCurrentSone(request.toadletContext)) + override fun handleRequest(freenetRequest: FreenetRequest, currentSone: Sone, templateContext: TemplateContext) { + if (freenetRequest.isPOST) { + if (freenetRequest.httpRequest.isPartSet("deleteSone")) { + webInterface.core.deleteSone(currentSone) } throw RedirectException("index.html") }