Move all AJAX handlers to the same directory as the HTML handlers.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / ajax / DeleteReplyAjaxPage.java
index fa9de9b..7614de8 100644 (file)
@@ -36,7 +36,7 @@ public class DeleteReplyAjaxPage extends JsonPage {
         *            The Sone web interface
         */
        public DeleteReplyAjaxPage(WebInterface webInterface) {
-               super("ajax/deleteReply.ajax", webInterface);
+               super("deleteReply.ajax", webInterface);
        }
 
        //
@@ -52,16 +52,16 @@ public class DeleteReplyAjaxPage extends JsonPage {
                Reply reply = webInterface.getCore().getReply(replyId);
                Sone currentSone = getCurrentSone(request.getToadletContext());
                if (reply == null) {
-                       return new JsonObject().put("success", false).put("error", "invalid-reply-id");
+                       return createErrorJsonObject("invalid-reply-id");
                }
                if (currentSone == null) {
-                       return new JsonObject().put("success", false).put("error", "auth-required");
+                       return createErrorJsonObject("auth-required");
                }
                if (!reply.getSone().equals(currentSone)) {
-                       return new JsonObject().put("success", false).put("error", "not-authorized");
+                       return createErrorJsonObject("not-authorized");
                }
                webInterface.getCore().deleteReply(reply);
-               return new JsonObject().put("success", true);
+               return createSuccessJsonObject();
        }
 
 }