X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FUnbookmarkAjaxPage.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FUnbookmarkAjaxPage.java;h=0000000000000000000000000000000000000000;hb=2cae21104ac3a7a53e2dafc92e0fefddb43fe41f;hp=94dd268b5e83c7b6ddb7fa93a628aa37e57bfede;hpb=21dedb25f4c512799fa35cb60581611bb2c92716;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/UnbookmarkAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/UnbookmarkAjaxPage.java deleted file mode 100644 index 94dd268..0000000 --- a/src/main/java/net/pterodactylus/sone/web/ajax/UnbookmarkAjaxPage.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Sone - UnbookmarkAjaxPage.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 net.pterodactylus.sone.data.Post; -import net.pterodactylus.sone.web.WebInterface; -import net.pterodactylus.sone.web.page.FreenetRequest; - -import com.google.common.base.Optional; - -/** - * AJAX page that lets the user unbookmark a post. - * - * @author David ‘Bombe’ Roden - */ -public class UnbookmarkAjaxPage extends JsonPage { - - /** - * Creates a new unbookmark AJAX page. - * - * @param webInterface - * The Sone web interface - */ - public UnbookmarkAjaxPage(WebInterface webInterface) { - super("unbookmark.ajax", webInterface); - } - - // - // JSONPAGE METHODS - // - - /** - * {@inheritDoc} - */ - @Override - protected JsonReturnObject createJsonObject(FreenetRequest request) { - String id = request.getHttpRequest().getParam("post", null); - if ((id == null) || (id.length() == 0)) { - return createErrorJsonObject("invalid-post-id"); - } - Optional post = webInterface.getCore().getPost(id); - if (post.isPresent()) { - webInterface.getCore().unbookmarkPost(post.get()); - } - return createSuccessJsonObject(); - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean requiresLogin() { - return false; - } - -}