X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FFollowSoneAjaxPage.java;h=3b51df2cd8aa6ca30ff9c4c99bf9c9bbeadd00e5;hb=53a71d1d6b91e4d56af49a06f2e06bc4d11bf3eb;hp=071f8e95fc8a1617a7a7587a5ccbff782b6cc23a;hpb=6f019de1d4d9742981d851ac3c9097cca8bff58e;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java index 071f8e9..3b51df2 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java @@ -22,7 +22,6 @@ import com.google.common.base.Optional; 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; /** * AJAX page that lets a Sone follow another Sone. @@ -45,16 +44,13 @@ public class FollowSoneAjaxPage extends JsonPage { * {@inheritDoc} */ @Override - protected JsonObject createJsonObject(FreenetRequest request) { + protected JsonReturnObject createJsonObject(FreenetRequest request) { String soneId = request.getHttpRequest().getParam("sone"); Optional sone = webInterface.getCore().getSone(soneId); if (!sone.isPresent()) { return createErrorJsonObject("invalid-sone-id"); } - Sone currentSone = getCurrentSone(request.getToadletContext()); - if (currentSone == null) { - return createErrorJsonObject("auth-required"); - } + Sone currentSone = getCurrentSone(request.getToadletContext()).get(); webInterface.getCore().followSone(currentSone, soneId); webInterface.getCore().markSoneKnown(sone.get()); return createSuccessJsonObject();