X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FTrustPage.kt;h=f8cb6dd249b4ade8f015be00d0eb6dab2be81ffc;hb=876c02e46d6c1f364bf824a8e3c9268b14845881;hp=bdc8952c351698488625aba4cb9e21e36709cc53;hpb=ffd92ca2374c0b2218e583d02e0bdd24b8c110ae;p=Sone.git diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/TrustPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/TrustPage.kt index bdc8952..f8cb6dd 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/TrustPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/TrustPage.kt @@ -1,26 +1,25 @@ package net.pterodactylus.sone.web.pages +import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.utils.isPOST -import net.pterodactylus.sone.utils.let 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 javax.inject.Inject /** * Page that lets the user trust another Sone. This will assign a configurable * amount of trust to an identity. */ -class TrustPage(template: Template, webInterface: WebInterface): - SoneTemplatePage("trust.html", template, "Page.Trust.Title", webInterface, true) { +class TrustPage @Inject constructor(template: Template, webInterface: WebInterface) : + LoggedInPage("trust.html", template, "Page.Trust.Title", webInterface) { - override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) { + override fun handleRequest(freenetRequest: FreenetRequest, currentSone: Sone, templateContext: TemplateContext) { if (freenetRequest.isPOST) { - getCurrentSone(freenetRequest.toadletContext)?.also { currentSone -> - webInterface.core.getSone(freenetRequest.parameters["sone"]).let { sone -> - webInterface.core.trustSone(currentSone, sone) - } + webInterface.core.getSone(freenetRequest.parameters["sone"]!!)?.let { sone -> + webInterface.core.trustSone(currentSone, sone) } throw RedirectException(freenetRequest.parameters["returnPage", 256]) }