X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FLockSoneAjaxPage.kt;h=c11dd0c51d91fba874fcd7863507eac76523248b;hp=add66b573f049bf42a1b7c3b88f987c904329576;hb=ea7ad5e87074576d17b7df74365a726bd95d7665;hpb=e9bc5900da836a751d3af427fef61e84e9fb3690 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/LockSoneAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/LockSoneAjaxPage.kt index add66b5..c11dd0c 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/LockSoneAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/LockSoneAjaxPage.kt @@ -3,18 +3,20 @@ package net.pterodactylus.sone.web.ajax import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.FreenetRequest +import javax.inject.Inject /** * Lets the user [lock][net.pterodactylus.sone.core.Core.lockSone] a [Sone][net.pterodactylus.sone.data.Sone]. */ -class LockSoneAjaxPage(webInterface: WebInterface) : JsonPage("lockSone.ajax", webInterface) { +class LockSoneAjaxPage @Inject constructor(webInterface: WebInterface) : + JsonPage("lockSone.ajax", webInterface) { - override fun requiresLogin() = false + override val requiresLogin = false override fun createJsonObject(request: FreenetRequest) = request.parameters["sone"] - .let(webInterface.core::getLocalSone) - ?.let(webInterface.core::lockSone) + .let(core::getLocalSone) + ?.let(core::lockSone) ?.let { createSuccessJsonObject() } ?: createErrorJsonObject("invalid-sone-id")