/*
- * Sone - DeletePostAjaxPage.java - Copyright © 2010 David Roden
+ * Sone - DeleteReplysAjaxPage.java - Copyright © 2010 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@Override
protected JsonObject createJsonObject(Request request) {
String replyId = request.getHttpRequest().getParam("reply");
- Reply reply = webInterface.core().getReply(replyId);
+ 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.core().deleteReply(reply);
- return new JsonObject().put("success", true);
+ webInterface.getCore().deleteReply(reply);
+ return createSuccessJsonObject();
}
}