X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FMarkAsKnownPage.kt;h=f9193185fbbe3921ac98b412c9c328e5a7166395;hp=22f21d85ffc8234e3581bad913cc4b533d54ac93;hb=faf66247a34f64946990a985d2ea3003465969cb;hpb=6a3f1fede0cda5cd6ed56204aa1dd37a19813cb9 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt index 22f21d8..f919318 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt @@ -12,8 +12,9 @@ import javax.inject.* * Page that lets the user mark a number of [net.pterodactylus.sone.data.Sone]s, [Post]s, or * [Replie][net.pterodactylus.sone.data.Reply]s as known. */ -class MarkAsKnownPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders): - SoneTemplatePage("markAsKnown.html", webInterface, loaders, template = template, pageTitleKey = "Page.MarkAsKnown.Title") { +@ToadletPath("markAsKnown.html") +class MarkAsKnownPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : + SoneTemplatePage(webInterface, loaders, templateRenderer, pageTitleKey = "Page.MarkAsKnown.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { val ids = soneRequest.parameters["id", 65536]!!.split(" ") @@ -21,9 +22,9 @@ class MarkAsKnownPage @Inject constructor(template: Template, webInterface: WebI "sone" -> ids.mapNotNull(soneRequest.core::getSone).forEach(soneRequest.core::markSoneKnown) "post" -> ids.mapNotNull(soneRequest.core::getPost).forEach(soneRequest.core::markPostKnown) "reply" -> ids.mapNotNull(soneRequest.core::getPostReply).forEach(soneRequest.core::markReplyKnown) - else -> throw RedirectException("invalid.html") + else -> redirectTo("invalid.html") } - throw RedirectException(soneRequest.parameters["returnPage", 256]!!) + redirectTo(soneRequest.parameters["returnPage", 256]!!) } }