X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FUnlikePage.kt;h=6bfabe2e68bc8e6fdbb86e69a77241bb9b310244;hb=9bb01bc8fe281e6748ebd744ade8945bee841213;hp=42e552e569ee1f8522002d36d444cf8cb0fcbbce;hpb=ffd92ca2374c0b2218e583d02e0bdd24b8c110ae;p=Sone.git 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 42e552e..6bfabe2 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt @@ -1,5 +1,6 @@ package net.pterodactylus.sone.web.pages +import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface @@ -11,13 +12,13 @@ import net.pterodactylus.util.template.TemplateContext * Page that lets the user unlike a [net.pterodactylus.sone.data.Post] or [net.pterodactylus.sone.data.Reply]. */ class UnlikePage(template: Template, webInterface: WebInterface): - SoneTemplatePage("unlike.html", template, "Page.Unlike.Title", webInterface, true) { + LoggedInPage("unlike.html", template, "Page.Unlike.Title", webInterface) { - override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) { + override fun handleRequest(freenetRequest: FreenetRequest, currentSone: Sone, templateContext: TemplateContext) { if (freenetRequest.isPOST) { when (freenetRequest.parameters["type"]) { - "post" -> getCurrentSone(freenetRequest.toadletContext)!!.removeLikedPostId(freenetRequest.parameters["post"]!!) - "reply" -> getCurrentSone(freenetRequest.toadletContext)!!.removeLikedReplyId(freenetRequest.parameters["reply"]!!) + "post" -> currentSone.removeLikedPostId(freenetRequest.parameters["post"]!!) + "reply" -> currentSone.removeLikedReplyId(freenetRequest.parameters["reply"]!!) } throw RedirectException(freenetRequest.parameters["returnPage", 256]) }