X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FDistrustAjaxPage.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FDistrustAjaxPage.java;h=0000000000000000000000000000000000000000;hb=be0349bd60c00fb7bc32d5b6d62270e1a46abdda;hp=26a1207ea18b54e1a9ebde9248aba820896a83e8;hpb=64268e8911d9d2052a41125ea5c0893926d1b2f4;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.java deleted file mode 100644 index 26a1207..0000000 --- a/src/main/java/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Sone - DistrustAjaxPage.java - Copyright © 2011–2016 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.pterodactylus.sone.web.ajax; - -import com.google.common.base.Optional; - -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; - -/** - * AJAX page that lets the user distrust a Sone. - * - * @see Core#distrustSone(Sone, Sone) - * @author David ‘Bombe’ Roden - */ -public class DistrustAjaxPage extends JsonPage { - - /** - * Creates a new “distrust Sone” AJAX handler. - * - * @param webInterface - * The Sone web interface - */ - public DistrustAjaxPage(WebInterface webInterface) { - super("distrustSone.ajax", webInterface); - } - - /** - * {@inheritDoc} - */ - @Override - protected JsonReturnObject createJsonObject(FreenetRequest request) { - Sone currentSone = getCurrentSone(request.getToadletContext(), false); - if (currentSone == null) { - return createErrorJsonObject("auth-required"); - } - String soneId = request.getHttpRequest().getParam("sone"); - Optional sone = webInterface.getCore().getSone(soneId); - if (!sone.isPresent()) { - return createErrorJsonObject("invalid-sone-id"); - } - webInterface.getCore().distrustSone(currentSone, sone.get()); - return createSuccessJsonObject().put("trustValue", webInterface.getCore().getPreferences().getNegativeTrust()); - } - -}