X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FUnlikePage.kt;h=cfb072e8e17317cb32e464e0bba69edc0567afe9;hp=6bfabe2e68bc8e6fdbb86e69a77241bb9b310244;hb=6a3f1fede0cda5cd6ed56204aa1dd37a19813cb9;hpb=74cbe983cd38da24847e6247ac595cb70d8e115b diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt index 6bfabe2..cfb072e 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt @@ -1,26 +1,28 @@ package net.pterodactylus.sone.web.pages import net.pterodactylus.sone.data.Sone +import net.pterodactylus.sone.main.* import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface -import net.pterodactylus.sone.web.page.FreenetRequest +import net.pterodactylus.sone.web.page.* import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext +import javax.inject.Inject /** * Page that lets the user unlike a [net.pterodactylus.sone.data.Post] or [net.pterodactylus.sone.data.Reply]. */ -class UnlikePage(template: Template, webInterface: WebInterface): - LoggedInPage("unlike.html", template, "Page.Unlike.Title", webInterface) { +class UnlikePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders): + LoggedInPage("unlike.html", template, "Page.Unlike.Title", webInterface, loaders) { - override fun handleRequest(freenetRequest: FreenetRequest, currentSone: Sone, templateContext: TemplateContext) { - if (freenetRequest.isPOST) { - when (freenetRequest.parameters["type"]) { - "post" -> currentSone.removeLikedPostId(freenetRequest.parameters["post"]!!) - "reply" -> currentSone.removeLikedReplyId(freenetRequest.parameters["reply"]!!) + override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { + if (soneRequest.isPOST) { + when (soneRequest.parameters["type"]) { + "post" -> currentSone.removeLikedPostId(soneRequest.parameters["post"]!!) + "reply" -> currentSone.removeLikedReplyId(soneRequest.parameters["reply"]!!) } - throw RedirectException(freenetRequest.parameters["returnPage", 256]) + throw RedirectException(soneRequest.parameters["returnPage", 256]) } }