projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move all AJAX handlers to the same directory as the HTML handlers.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
web
/
ajax
/
DeletePostAjaxPage.java
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/DeletePostAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/DeletePostAjaxPage.java
index
16c047d
..
479e71e
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/DeletePostAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/DeletePostAjaxPage.java
@@
-36,7
+36,7
@@
public class DeletePostAjaxPage extends JsonPage {
* The Sone web interface
*/
public DeletePostAjaxPage(WebInterface webInterface) {
* The Sone web interface
*/
public DeletePostAjaxPage(WebInterface webInterface) {
- super("
ajax/
deletePost.ajax", webInterface);
+ super("deletePost.ajax", webInterface);
}
//
}
//
@@
-49,9
+49,9
@@
public class DeletePostAjaxPage extends JsonPage {
@Override
protected JsonObject createJsonObject(Request request) {
String postId = request.getHttpRequest().getParam("post");
@Override
protected JsonObject createJsonObject(Request request) {
String postId = request.getHttpRequest().getParam("post");
- Post post = webInterface.getCore().getPost(postId);
+ Post post = webInterface.getCore().getPost(postId
, false
);
Sone currentSone = getCurrentSone(request.getToadletContext());
Sone currentSone = getCurrentSone(request.getToadletContext());
- if (
post == null
) {
+ if (
(post == null) || (post.getSone() == null)
) {
return createErrorJsonObject("invalid-post-id");
}
if (currentSone == null) {
return createErrorJsonObject("invalid-post-id");
}
if (currentSone == null) {
@@
-60,8
+60,8
@@
public class DeletePostAjaxPage extends JsonPage {
if (!post.getSone().equals(currentSone)) {
return createErrorJsonObject("not-authorized");
}
if (!post.getSone().equals(currentSone)) {
return createErrorJsonObject("not-authorized");
}
-
currentSone.remov
ePost(post);
- return
new JsonObject().put("success", true
);
+
webInterface.getCore().delet
ePost(post);
+ return
createSuccessJsonObject(
);
}
}
}
}