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