1 package net.pterodactylus.sone.web.pages
3 import net.pterodactylus.sone.utils.isPOST
4 import net.pterodactylus.sone.utils.parameters
5 import net.pterodactylus.sone.web.WebInterface
6 import net.pterodactylus.sone.web.page.FreenetRequest
7 import net.pterodactylus.util.template.Template
8 import net.pterodactylus.util.template.TemplateContext
11 * Page that lets the user unlike a [net.pterodactylus.sone.data.Post] or [net.pterodactylus.sone.data.Reply].
13 class UnlikePage(template: Template, webInterface: WebInterface):
14 SoneTemplatePage("unlike.html", template, "Page.Unlike.Title", webInterface, true) {
16 override fun handleRequest(request: FreenetRequest, templateContext: TemplateContext) {
18 when (request.parameters["type"]) {
19 "post" -> getCurrentSone(request.toadletContext)!!.removeLikedPostId(request.parameters["post"]!!)
20 "reply" -> getCurrentSone(request.toadletContext)!!.removeLikedReplyId(request.parameters["reply"]!!)
22 throw RedirectException(request.parameters["returnPage", 256])