mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-06-12 09:54 pm

[dw-free] Invalid form submission when posting comment should contain the comment text

[commit: http://hg.dwscoalition.org/dw-free/rev/5c13ca636146]

http://bugs.dwscoalition.org/show_bug.cgi?id=126

Reshow the comment form in case of an error in the form submission. Helps
prevent a situation where comments can be dropped on the floor.

Patch by [personal profile] afuna.

Files modified:
  • htdocs/talkpost_do.bml
  • htdocs/talkpost_do.bml.text
--------------------------------------------------------------------------------
diff -r 4095983b9f9e -r 5c13ca636146 htdocs/talkpost_do.bml
--- a/htdocs/talkpost_do.bml	Fri Jun 12 21:48:33 2009 +0000
+++ b/htdocs/talkpost_do.bml	Fri Jun 12 21:54:27 2009 +0000
@@ -111,8 +111,9 @@ body<=
 
     # FIXME: this isn't entirely correct, if ecphash is present but ignored/incorrect
     # that fix would need to be done in talklib.pl
-    return "<?h1 $ML{'Error'} h1?> $ML{'error.invalidform'}"
-        if $remote && ! ($skip_form_auth || $POST{'ecphash'} || LJ::check_form_auth());
+
+    # show this error along with the regenerated comment form down below
+    push @errors, $ML{'.error.invalidform'} if $remote && ! ( $skip_form_auth || $POST{ecphash} || LJ::check_form_auth() );
 
     ## preview
     # ignore errors for previewing
diff -r 4095983b9f9e -r 5c13ca636146 htdocs/talkpost_do.bml.text
--- a/htdocs/talkpost_do.bml.text	Fri Jun 12 21:48:33 2009 +0000
+++ b/htdocs/talkpost_do.bml.text	Fri Jun 12 21:54:27 2009 +0000
@@ -13,6 +13,8 @@
 .error.deleted=Your journal has been deleted.  You can't post messages.
 
 .error.friendsonly=Only friends of [[user]] may post in this journal.
+
+.error.invalidform=Invalid form submission. You may have left the reply form open too long, or logged out since you opened the page. Please try posting again.
 
 .error.membersonly=Only members of [[user]] can post in this community.
 
--------------------------------------------------------------------------------