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 like [net.pterodactylus.sone.data.Post]s and [net.pterodactylus.sone.data.Reply]s.
13 class LikePage(template: Template, webInterface: WebInterface)
14 : SoneTemplatePage("like.html", template, "Page.Like.Title", webInterface, true) {
16 override fun handleRequest(request: FreenetRequest, templateContext: TemplateContext) {
18 getCurrentSone(request.toadletContext)!!.let { currentSone ->
19 request.parameters["type", 16]?.also { type ->
21 "post" -> currentSone.addLikedPostId(request.parameters["post", 36]!!)
22 "reply" -> currentSone.addLikedReplyId(request.parameters["reply", 36]!!)
25 throw RedirectException(request.parameters["returnPage", 256]!!)