From 056abe07e4ce6ba8ebca48396e36fcbefbbcc5e4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 5 Sep 2012 12:13:30 +0200 Subject: [PATCH] Return configured trust values immediately. --- .../java/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.java | 7 +------ src/main/java/net/pterodactylus/sone/web/ajax/TrustAjaxPage.java | 7 +------ src/main/java/net/pterodactylus/sone/web/ajax/UntrustAjaxPage.java | 7 +------ 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.java index f25b19c..6e72a5a 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.java @@ -19,7 +19,6 @@ package net.pterodactylus.sone.web.ajax; import net.pterodactylus.sone.core.Core; import net.pterodactylus.sone.data.Sone; -import net.pterodactylus.sone.freenet.wot.Trust; import net.pterodactylus.sone.web.WebInterface; import net.pterodactylus.sone.web.page.FreenetRequest; import net.pterodactylus.util.json.JsonObject; @@ -57,11 +56,7 @@ public class DistrustAjaxPage extends JsonPage { return createErrorJsonObject("invalid-sone-id"); } webInterface.getCore().distrustSone(currentSone, sone); - Trust trust = webInterface.getCore().getTrust(currentSone, sone); - if (trust == null) { - return createErrorJsonObject("wot-plugin"); - } - return createSuccessJsonObject().put("trustValue", trust.getExplicit()); + return createSuccessJsonObject().put("trustValue", webInterface.getCore().getPreferences().getNegativeTrust()); } } diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/TrustAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/TrustAjaxPage.java index 9b86c5e..5b27d1b 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/TrustAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/TrustAjaxPage.java @@ -19,7 +19,6 @@ package net.pterodactylus.sone.web.ajax; import net.pterodactylus.sone.core.Core; import net.pterodactylus.sone.data.Sone; -import net.pterodactylus.sone.freenet.wot.Trust; import net.pterodactylus.sone.web.WebInterface; import net.pterodactylus.sone.web.page.FreenetRequest; import net.pterodactylus.util.json.JsonObject; @@ -57,11 +56,7 @@ public class TrustAjaxPage extends JsonPage { return createErrorJsonObject("invalid-sone-id"); } webInterface.getCore().trustSone(currentSone, sone); - Trust trust = webInterface.getCore().getTrust(currentSone, sone); - if (trust == null) { - return createErrorJsonObject("wot-plugin"); - } - return createSuccessJsonObject().put("trustValue", trust.getExplicit()); + return createSuccessJsonObject().put("trustValue", webInterface.getCore().getPreferences().getPositiveTrust()); } } diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/UntrustAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/UntrustAjaxPage.java index 932be6c..916b6e9 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/UntrustAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/UntrustAjaxPage.java @@ -19,7 +19,6 @@ package net.pterodactylus.sone.web.ajax; import net.pterodactylus.sone.core.Core; import net.pterodactylus.sone.data.Sone; -import net.pterodactylus.sone.freenet.wot.Trust; import net.pterodactylus.sone.web.WebInterface; import net.pterodactylus.sone.web.page.FreenetRequest; import net.pterodactylus.util.json.JsonObject; @@ -57,11 +56,7 @@ public class UntrustAjaxPage extends JsonPage { return createErrorJsonObject("invalid-sone-id"); } webInterface.getCore().untrustSone(currentSone, sone); - Trust trust = webInterface.getCore().getTrust(currentSone, sone); - if (trust == null) { - return createErrorJsonObject("wot-plugin"); - } - return createSuccessJsonObject().put("trustValue", trust.getExplicit()); + return createSuccessJsonObject().put("trustValue", (String) null); } } -- 2.7.4