X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FTrustPage.kt;h=758ae0703002a7de6f93c09105be2be0d01c75b1;hb=6f1f26e3998cfef155b0cf59152827accea70d30;hp=bdc8952c351698488625aba4cb9e21e36709cc53;hpb=3cb0e2c78bb37f2d70ecde92ad4fcf642de788a3;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..758ae07 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/TrustPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/TrustPage.kt @@ -1,7 +1,7 @@ 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 @@ -12,15 +12,13 @@ import net.pterodactylus.util.template.TemplateContext * 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(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]) }