Remove possibility to create Sones from sone provider interface.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / ajax / DistrustAjaxPage.java
index 7bc9aa9..b86055d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - TrustAjaxPage.java - Copyright © 2011 David Roden
+ * Sone - DistrustAjaxPage.java - Copyright © 2011–2013 David Roden
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@ package net.pterodactylus.sone.web.ajax;
 import net.pterodactylus.sone.core.Core;
 import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.web.WebInterface;
+import net.pterodactylus.sone.web.page.FreenetRequest;
 import net.pterodactylus.util.json.JsonObject;
 
 /**
@@ -44,18 +45,18 @@ public class DistrustAjaxPage extends JsonPage {
         * {@inheritDoc}
         */
        @Override
-       protected JsonObject createJsonObject(Request request) {
+       protected JsonObject createJsonObject(FreenetRequest request) {
                Sone currentSone = getCurrentSone(request.getToadletContext(), false);
                if (currentSone == null) {
                        return createErrorJsonObject("auth-required");
                }
                String soneId = request.getHttpRequest().getParam("sone");
-               Sone sone = webInterface.getCore().getSone(soneId, false);
+               Sone sone = webInterface.getCore().getSone(soneId);
                if (sone == null) {
                        return createErrorJsonObject("invalid-sone-id");
                }
                webInterface.getCore().distrustSone(currentSone, sone);
-               return createSuccessJsonObject().put("trustValue", webInterface.getCore().getTrust(currentSone, sone).getExplicit());
+               return createSuccessJsonObject().put("trustValue", webInterface.getCore().getPreferences().getNegativeTrust());
        }
 
 }