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=7f719b7c0904aae418966b6b611fe7a0c5b76e67;hp=6092643709632dac32d53f371abb271e0c14f64d;hb=89a905395984ec35e313b07594e21773ffd3d9d8;hpb=6f1e7806171eb6af95c8669f2ac0801e34b9246a 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 6092643..7f719b7 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.java @@ -35,7 +35,7 @@ public class UnfollowSoneAjaxPage extends JsonPage { * The Sone web interface */ public UnfollowSoneAjaxPage(WebInterface webInterface) { - super("ajax/unfollowSone.ajax", webInterface); + super("unfollowSone.ajax", webInterface); } /** @@ -45,15 +45,15 @@ public class UnfollowSoneAjaxPage extends JsonPage { protected JsonObject createJsonObject(Request request) { String soneId = request.getHttpRequest().getParam("sone"); if (!webInterface.getCore().hasSone(soneId)) { - return new JsonObject().put("success", false).put("error", "invalid-sone-id"); + return createErrorJsonObject("invalid-sone-id"); } Sone currentSone = getCurrentSone(request.getToadletContext()); if (currentSone == null) { - return new JsonObject().put("success", false).put("error", "auth-required"); + return createErrorJsonObject("auth-required"); } currentSone.removeFriend(soneId); - webInterface.getCore().saveSone(currentSone); - return new JsonObject().put("success", true); + webInterface.getCore().touchConfiguration(); + return createSuccessJsonObject(); } }