X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FDistrustAjaxPage.kt;h=cbeed6e41a2dad4d7a88d7515ac3887f32e4e29b;hb=HEAD;hp=4eadfde45e2fca59b05a08c2972cdeaa3ecc5adb;hpb=8e313509a42a8c638fcac018dd73dd975bf9cb68;p=Sone.git diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.kt deleted file mode 100644 index 4eadfde..0000000 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.kt +++ /dev/null @@ -1,28 +0,0 @@ -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 - -/** - * AJAX page that lets the user distrust a Sone. - * - * @see Core.distrustSone(Sone, Sone) - */ -class DistrustAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("distrustSone.ajax", webInterface) { - - override fun createJsonObject(currentSone: Sone, request: FreenetRequest) = - request.parameters["sone"] - ?.let(core::getSone) - ?.let { sone -> - createSuccessJsonObject() - .put("trustValue", core.preferences.negativeTrust) - .also { - core.distrustSone(currentSone, sone) - } - } ?: createErrorJsonObject("invalid-sone-id") - -}