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=46bd3abd85e68bccaa95d6c93030a0b6e2a4a840;hp=7737638c253d396d73263f5d9c3839f9b18cb177;hb=faf66247a34f64946990a985d2ea3003465969cb;hpb=e3da46d8947ab8a542a156069b3b24c13fd011df 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 7737638..46bd3ab 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt @@ -1,20 +1,19 @@ package net.pterodactylus.sone.web.pages -import net.pterodactylus.sone.data.Sone +import net.pterodactylus.sone.data.* 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.utils.* +import net.pterodactylus.sone.web.* import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template -import net.pterodactylus.util.template.TemplateContext -import javax.inject.Inject +import net.pterodactylus.util.template.* +import javax.inject.* /** * Page that lets the user unlike a [net.pterodactylus.sone.data.Post] or [net.pterodactylus.sone.data.Reply]. */ -class UnlikePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("unlike.html", template, "Page.Unlike.Title", webInterface, loaders, templateRenderer) { +@ToadletPath("unlike.html") +class UnlikePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : + LoggedInPage("Page.Unlike.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { @@ -22,7 +21,7 @@ class UnlikePage @Inject constructor(template: Template, webInterface: WebInterf "post" -> currentSone.removeLikedPostId(soneRequest.parameters["post"]!!) "reply" -> currentSone.removeLikedReplyId(soneRequest.parameters["reply"]!!) } - throw RedirectException(soneRequest.parameters["returnPage", 256]) + redirectTo(soneRequest.parameters["returnPage", 256]) } }