X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FCreateSonePage.kt;h=efa6f1dc8a346ab928aefdb36274bf0ff957f6ee;hp=600734638fab7a6b67e009b9dd1066df92a41580;hb=3cb0e2c78bb37f2d70ecde92ad4fcf642de788a3;hpb=cec099ef08feaff5332b81885ad989dbcb0fdfba diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateSonePage.kt index 6007346..efa6f1d 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateSonePage.kt @@ -18,17 +18,17 @@ class CreateSonePage(template: Template, webInterface: WebInterface): private val logger = Logger.getLogger(CreateSonePage::class.java.name) - override fun handleRequest(request: FreenetRequest, templateContext: TemplateContext) { + override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) { templateContext["sones"] = webInterface.core.localSones.sortedWith(Sone.NICE_NAME_COMPARATOR) templateContext["identitiesWithoutSone"] = webInterface.core.identityManager.allOwnIdentities.filterNot { "Sone" in it.contexts }.sortedBy { "${it.nickname}@${it.id}".toLowerCase() } - if (request.isPOST) { - val identity = request.httpRequest.getPartAsStringFailsafe("identity", 43) + if (freenetRequest.isPOST) { + val identity = freenetRequest.httpRequest.getPartAsStringFailsafe("identity", 43) webInterface.core.identityManager.allOwnIdentities.firstOrNull { it.id == identity }?.let { ownIdentity -> val sone = webInterface.core.createSone(ownIdentity) if (sone == null) { logger.log(Level.SEVERE, "Could not create Sone for OwnIdentity: $ownIdentity") } - setCurrentSone(request.toadletContext, sone) + setCurrentSone(freenetRequest.toadletContext, sone) throw RedirectException("index.html") } templateContext["errorNoIdentity"] = true