X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FCreateReplyPage.java;h=2bfab6ff76d897c3e7eb1bad19ac2034c2f2e64a;hb=952e56e8a89eb706d8ff5e2f652c165b646a06f3;hp=e48232e56fa9d0fa9b8751197c0bedaa50789de4;hpb=66f29561ceb5acbf42a4b8319f1c79ccbfba0979;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java b/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java index e48232e..2bfab6f 100644 --- a/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java +++ b/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java @@ -38,7 +38,7 @@ public class CreateReplyPage extends SoneTemplatePage { * The Sone web interface */ public CreateReplyPage(Template template, WebInterface webInterface) { - super("createReply.html", template, "Page.CreateReply.Title", webInterface); + super("createReply.html", template, "Page.CreateReply.Title", webInterface, true); } // @@ -50,31 +50,22 @@ public class CreateReplyPage extends SoneTemplatePage { */ @Override protected void processTemplate(Request request, Template template) throws RedirectException { - String postId = request.getHttpRequest().getPartAsStringFailsafe("postId", 36); + super.processTemplate(request, template); + String postId = request.getHttpRequest().getPartAsStringFailsafe("post", 36); String text = request.getHttpRequest().getPartAsStringFailsafe("text", 65536).trim(); + String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256); if (request.getMethod() == Method.POST) { - Post post = webInterface.core().getPost(postId); + Post post = webInterface.getCore().getPost(postId); if (text.length() > 0) { Sone currentSone = getCurrentSone(request.getToadletContext()); - webInterface.core().createReply(currentSone, post, text); - throw new RedirectException("viewPost.html?post=" + post.getId()); + webInterface.getCore().createReply(currentSone, post, text); + throw new RedirectException(returnPage); } template.set("errorTextEmpty", true); } template.set("postId", postId); template.set("text", text); - } - - // - // SONETEMPLATEPAGE METHODS - // - - /** - * {@inheritDoc} - */ - @Override - protected boolean requiresLogin() { - return true; + template.set("returnPage", returnPage); } }