From b05da8b28547c757aa986306c9e88bc5521b174c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 19 Oct 2010 22:35:36 +0200 Subject: [PATCH] Return to correct page when user tries to post an empty post. --- src/main/java/net/pterodactylus/sone/web/CreatePostPage.java | 3 +++ src/main/resources/templates/createPost.html | 1 + 2 files changed, 4 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/web/CreatePostPage.java b/src/main/java/net/pterodactylus/sone/web/CreatePostPage.java index d2bd5da..05aceac 100644 --- a/src/main/java/net/pterodactylus/sone/web/CreatePostPage.java +++ b/src/main/java/net/pterodactylus/sone/web/CreatePostPage.java @@ -51,6 +51,7 @@ public class CreatePostPage extends SoneTemplatePage { @Override protected void processTemplate(Request request, Template template) throws RedirectException { super.processTemplate(request, template); + template.set("returnPage", request.getUri()); if (request.getMethod() == Method.POST) { String text = request.getHttpRequest().getPartAsStringFailsafe("text", 65536).trim(); String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 64); @@ -60,7 +61,9 @@ public class CreatePostPage extends SoneTemplatePage { throw new RedirectException(returnPage); } template.set("errorTextEmpty", true); + template.set("returnPage", returnPage); } + } // diff --git a/src/main/resources/templates/createPost.html b/src/main/resources/templates/createPost.html index de1196b..ca9171b 100644 --- a/src/main/resources/templates/createPost.html +++ b/src/main/resources/templates/createPost.html @@ -8,6 +8,7 @@
+
-- 2.7.4