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=ab93fed700996240892e85219b3a1a8c2574d3db;hp=6bfabe2e68bc8e6fdbb86e69a77241bb9b310244;hb=c28013c8a4bcb9776a1e2d82ffd6c4c8297ffb62;hpb=6f1f26e3998cfef155b0cf59152827accea70d30 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..ab93fed 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt @@ -4,23 +4,24 @@ import net.pterodactylus.sone.data.Sone 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): +class UnlikePage @Inject constructor(template: Template, webInterface: WebInterface): LoggedInPage("unlike.html", template, "Page.Unlike.Title", webInterface) { - 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]) } }