X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FDistrustAjaxPage.kt;h=e4f23276f8f15cb70e4978cd877311fefb6130c1;hp=e4f8435daf11a9302f135ba94046a2d5d8c2b771;hb=d14188d87056cfd63490ef9f16f4aae0c1864864;hpb=85b7420f3492af4e5591f62ad673309a76de7e04 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.kt index e4f8435..e4f2327 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.kt @@ -1,22 +1,23 @@ package net.pterodactylus.sone.web.ajax -import net.pterodactylus.sone.core.Core -import net.pterodactylus.sone.data.Sone -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.core.* +import net.pterodactylus.sone.data.* +import net.pterodactylus.sone.utils.* +import net.pterodactylus.sone.web.* +import net.pterodactylus.sone.web.page.* +import javax.inject.* /** * AJAX page that lets the user distrust a Sone. * * @see Core.distrustSone(Sone, Sone) */ -class DistrustAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("distrustSone.ajax", webInterface) { +class DistrustAjaxPage @Inject constructor(webInterface: WebInterface) : + LoggedInJsonPage("distrustSone.ajax", webInterface) { override fun createJsonObject(currentSone: Sone, request: FreenetRequest) = request.parameters["sone"] - .let(core::getSone) + ?.let(core::getSone) ?.let { sone -> createSuccessJsonObject() .put("trustValue", core.preferences.negativeTrust)