X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FFollowSoneAjaxPage.java;h=6d98b43de5095d4e62c24e0729dcdc105de5d9a2;hp=0c835533fc084fe140f706e121a6b6dac480a0b0;hb=62ebf3da00001abb841c92128c4fdb57d0795ee2;hpb=7ec5cf4d41166dab589d026256ee995068577ef2 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 0c83553..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,15 +44,14 @@ public class FollowSoneAjaxPage extends JsonPage { @Override protected JsonObject createJsonObject(Request request) { String soneId = request.getHttpRequest().getParam("sone"); - Sone sone = webInterface.getCore().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); + currentSone.addFriend(soneId); webInterface.getCore().saveSone(currentSone); return new JsonObject().put("success", true); }