X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FUnfollowSoneAjaxPage.java;h=6092643709632dac32d53f371abb271e0c14f64d;hp=509f629f4a8a36f863a06a05fd84b13be60959f8;hb=6f1e7806171eb6af95c8669f2ac0801e34b9246a;hpb=e01b70a4ccf10908ffdf694d857c7df1d1d48dca diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.java index 509f629..6092643 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.java @@ -44,15 +44,14 @@ public class UnfollowSoneAjaxPage 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.removeFriend(sone); + currentSone.removeFriend(soneId); webInterface.getCore().saveSone(currentSone); return new JsonObject().put("success", true); }