projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove bucket and access type from command interface
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
web
/
DeleteReplyPage.java
diff --git
a/src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java
b/src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java
index
4502617
..
aa8bc8f
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java
@@
-1,5
+1,5
@@
/*
/*
- * Sone - DeleteReplyPage.java - Copyright © 2010 David Roden
+ * Sone - DeleteReplyPage.java - Copyright © 2010
–2016
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
*
* 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
@@
-23,6
+23,8
@@
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateContext;
import net.pterodactylus.util.web.Method;
import net.pterodactylus.util.template.TemplateContext;
import net.pterodactylus.util.web.Method;
+import com.google.common.base.Optional;
+
/**
* This page lets the user delete a reply.
*
/**
* This page lets the user delete a reply.
*
@@
-50,23
+52,22
@@
public class DeleteReplyPage extends SoneTemplatePage {
* {@inheritDoc}
*/
@Override
* {@inheritDoc}
*/
@Override
- protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
- super.processTemplate(request, templateContext);
+ protected void handleRequest(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
String replyId = request.getHttpRequest().getPartAsStringFailsafe("reply", 36);
String replyId = request.getHttpRequest().getPartAsStringFailsafe("reply", 36);
-
PostReply reply = webInterface.getCore().ge
tReply(replyId);
+
Optional<PostReply> reply = webInterface.getCore().getPos
tReply(replyId);
String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256);
if (request.getMethod() == Method.POST) {
String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256);
if (request.getMethod() == Method.POST) {
- if (!
webInterface.getCore().isLocalSone(reply.getSone()
)) {
+ if (!
reply.isPresent() || !reply.get().getSone().isLocal(
)) {
throw new RedirectException("noPermission.html");
}
if (request.getHttpRequest().isPartSet("confirmDelete")) {
throw new RedirectException("noPermission.html");
}
if (request.getHttpRequest().isPartSet("confirmDelete")) {
- webInterface.getCore().deleteReply(reply);
+ webInterface.getCore().deleteReply(reply
.get()
);
throw new RedirectException(returnPage);
} else if (request.getHttpRequest().isPartSet("abortDelete")) {
throw new RedirectException(returnPage);
}
}
throw new RedirectException(returnPage);
} else if (request.getHttpRequest().isPartSet("abortDelete")) {
throw new RedirectException(returnPage);
}
}
- templateContext.set("reply", reply);
+ templateContext.set("reply", reply
Id
);
templateContext.set("returnPage", returnPage);
}
templateContext.set("returnPage", returnPage);
}