X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FUntrustAjaxPage.kt;h=e4b5edb2c618c147e16ae7774f7114d2b190ee62;hp=e622554a4aa64e884e1f1242c4dadab2a01c3b6c;hb=ca45de0dcbd2e361ab630bbee1d47ff6cf34d97c;hpb=bffa2f59940c78942d57897971702d03e10cdc20 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/UntrustAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/UntrustAjaxPage.kt index e622554..e4b5edb 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/UntrustAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/UntrustAjaxPage.kt @@ -1,21 +1,21 @@ package net.pterodactylus.sone.web.ajax import net.pterodactylus.sone.data.Sone -import net.pterodactylus.sone.utils.also -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.sone.web.page.* +import javax.inject.Inject /** * AJAX page that lets the user [untrust][net.pterodactylus.sone.core.Core.untrustSone] a [Sone]. */ -class UntrustAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("untrustSone.ajax", webInterface) { +@ToadletPath("untrustSone.ajax") +class UntrustAjaxPage @Inject constructor(webInterface: WebInterface) : LoggedInJsonPage(webInterface) { override fun createJsonObject(currentSone: Sone, request: FreenetRequest) = request.parameters["sone"] - ?.let(webInterface.core::getSone) - ?.also { webInterface.core.untrustSone(currentSone, it) } + ?.let(core::getSone) + ?.also { core.untrustSone(currentSone, it) } ?.let { createSuccessJsonObject() } ?: createErrorJsonObject("invalid-sone-id")