X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FTrustAjaxPage.kt;h=ef806ebdb6086486cbaa6e175830049e6361ffba;hp=228a0b5a946dcfadc270f036404ffb0982def514;hb=ea7ad5e87074576d17b7df74365a726bd95d7665;hpb=434e72844bb54f24fc7d2d26acc315d39ee3ba6f;ds=sidebyside diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/TrustAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/TrustAjaxPage.kt index 228a0b5..ef806eb 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/TrustAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/TrustAjaxPage.kt @@ -5,19 +5,21 @@ 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 javax.inject.Inject /** * AJAX page that lets the user trust a Sone. * * @see net.pterodactylus.sone.core.Core.trustSone */ -class TrustAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("trustSone.ajax", webInterface) { +class TrustAjaxPage @Inject constructor(webInterface: WebInterface) : + LoggedInJsonPage("trustSone.ajax", webInterface) { override fun createJsonObject(currentSone: Sone, request: FreenetRequest) = request.parameters["sone"] - .let(webInterface.core::getSone) - ?.let { webInterface.core.trustSone(currentSone, it) } - ?.let { createSuccessJsonObject().put("trustValue", webInterface.core.preferences.positiveTrust) } + ?.let(core::getSone) + ?.let { core.trustSone(currentSone, it) } + ?.let { createSuccessJsonObject().put("trustValue", core.preferences.positiveTrust) } ?: createErrorJsonObject("invalid-sone-id") }