X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FFollowSoneAjaxPage.java;h=6d98b43de5095d4e62c24e0729dcdc105de5d9a2;hb=62ebf3da00001abb841c92128c4fdb57d0795ee2;hp=7dc1b247d5a3e9629fb0fda99abcc65cba0c62cf;hpb=01d2e31e5687276b5104edc27c3416d4cd9b89b8;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 7dc1b24..6d98b43 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java @@ -44,16 +44,15 @@ public class FollowSoneAjaxPage extends JsonPage { @Override protected JsonObject createJsonObject(Request request) { String soneId = request.getHttpRequest().getParam("sone"); - Sone sone = webInterface.core().getSone(soneId); - if (sone == null) { + if (!webInterface.getCore().hasSone(soneId)) { return new JsonObject().put("success", false).put("error", "invalid-sone-id"); } Sone currentSone = getCurrentSone(request.getToadletContext()); if (currentSone == null) { return new JsonObject().put("success", false).put("error", "auth-required"); } - currentSone.addFriend(sone); - webInterface.core().saveSone(currentSone); + currentSone.addFriend(soneId); + webInterface.getCore().saveSone(currentSone); return new JsonObject().put("success", true); }