X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FLikeAjaxPage.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FLikeAjaxPage.java;h=258eb7facc2f4f0e40159dfe0f1d33c21b09e9d2;hb=dc3d0d58fd47e520c723aa7d258c2f7ae09e1ee7;hp=23a5aeca41ba98166f314106204b6bf8e5015386;hpb=6fdee5deb36fd25bf706b445f2315ea00480cddf;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/LikeAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/LikeAjaxPage.java index 23a5aec..258eb7f 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/LikeAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/LikeAjaxPage.java @@ -47,18 +47,18 @@ public class LikeAjaxPage extends JsonPage { String type = request.getHttpRequest().getParam("type", null); String id = request.getHttpRequest().getParam(type, null); if ((id == null) || (id.length() == 0)) { - return new JsonObject().put("success", false).put("error", "invalid-" + type + "-id"); + return createErrorJsonObject("invalid-" + type + "-id"); } Sone currentSone = getCurrentSone(request.getToadletContext()); if (currentSone == null) { - return new JsonObject().put("success", false).put("error", "auth-required"); + return createErrorJsonObject("auth-required"); } if ("post".equals(type)) { currentSone.addLikedPostId(id); } else if ("reply".equals(type)) { currentSone.addLikedReplyId(id); } else { - return new JsonObject().put("success", false).put("error", "invalid-type"); + return createErrorJsonObject("invalid-type"); } return new JsonObject().put("success", true); }