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=f071bcd35746dd219e269f22865eddfb905b5789;hp=31e70fc4b39e12fae0519bc97371b7c192a9d164;hb=d14188d87056cfd63490ef9f16f4aae0c1864864;hpb=fafe0029dcbef27ce918fdf7007e78c8705ca20f 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 31e70fc..f071bcd 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt @@ -1,25 +1,24 @@ package net.pterodactylus.sone.web.pages -import net.pterodactylus.sone.data.Post -import net.pterodactylus.sone.utils.mapPresent -import net.pterodactylus.sone.utils.parameters -import net.pterodactylus.sone.web.WebInterface -import net.pterodactylus.sone.web.page.FreenetRequest -import net.pterodactylus.util.template.Template -import net.pterodactylus.util.template.TemplateContext +import net.pterodactylus.sone.data.* +import net.pterodactylus.sone.utils.* +import net.pterodactylus.sone.web.* +import net.pterodactylus.sone.web.page.* +import net.pterodactylus.util.template.* +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(template: Template, webInterface: WebInterface): - SoneTemplatePage("markAsKnown.html", template, "Page.MarkAsKnown.Title", webInterface, false) { +class MarkAsKnownPage @Inject constructor(template: Template, webInterface: WebInterface): + SoneTemplatePage("markAsKnown.html", webInterface, template, "Page.MarkAsKnown.Title") { override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) { val ids = freenetRequest.parameters["id", 65536]!!.split(" ") when (freenetRequest.parameters["type", 5]) { "sone" -> ids.mapNotNull(webInterface.core::getSone).forEach(webInterface.core::markSoneKnown) - "post" -> ids.mapPresent(webInterface.core::getPost).forEach(webInterface.core::markPostKnown) + "post" -> ids.mapNotNull(webInterface.core::getPost).forEach(webInterface.core::markPostKnown) "reply" -> ids.mapNotNull(webInterface.core::getPostReply).forEach(webInterface.core::markReplyKnown) else -> throw RedirectException("invalid.html") }