mysociety / sobanukirwa-theme

The Alavateli theme for Sobanukirwa (Rwanda)
https://sobanukirwa.rw
MIT License
1 stars 3 forks source link

Backport fix for HelpController#catch_spam method #91

Closed lizconlan closed 6 years ago

lizconlan commented 6 years ago

Before Alaveteli version 0.25.0.0, the catch_spam method in the help controller can cause site errors if the contact field is not filled in.

Original fix here https://github.com/mysociety/alaveteli/commit/d62498d26fe3250665ba0751e680b0c843adf65f

(Tested locally - adding the theme code prevents an error when posting random data to the form)

Fixes #90

Note for reviewer/future readers

bundle update debugger-ruby_core_source may be required to install gems for a 0.22.4.9site under the latest Ruby 1.9.3 (just found out the hard way)

lizconlan commented 6 years ago

commenting the code out results in...

Started POST "/help/contact" for 10.10.10.1 at 2018-07-27 15:48:56 +0000
Processing by HelpController#contact as */*
  Parameters: {"contactName"=>"test", "submitted"=>"true"}
Completed 500 Internal Server Error in 4.6ms

NoMethodError (undefined method `[]' for nil:NilClass):
  app/controllers/help_controller.rb:81:in `catch_spam'

(with the code in place it re-renders the form)