1 package net.pterodactylus.sone.web.ajax
3 import net.pterodactylus.sone.core.*
4 import net.pterodactylus.sone.data.*
5 import net.pterodactylus.sone.utils.*
6 import net.pterodactylus.sone.web.*
7 import net.pterodactylus.sone.web.page.*
11 * AJAX page that lets the user distrust a Sone.
13 * @see Core.distrustSone(Sone, Sone)
15 @ToadletPath("distrustSone.ajax")
16 class DistrustAjaxPage @Inject constructor(webInterface: WebInterface) : LoggedInJsonPage(webInterface) {
18 override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
19 request.parameters["sone"]
22 createSuccessJsonObject()
23 .put("trustValue", core.preferences.negativeTrust)
25 core.distrustSone(currentSone, sone)
27 } ?: createErrorJsonObject("invalid-sone-id")