diff options
author | francis <francis> | 2008-01-04 16:15:40 +0000 |
---|---|---|
committer | francis <francis> | 2008-01-04 16:15:40 +0000 |
commit | 632b33cc0ca09c398bb1d4a21000b39987b53220 (patch) | |
tree | 6f053d1353869d04b60ce54b320dbc32d9b78ea0 | |
parent | f30b34ecfd7c9916ee9b9034d5c4cd4cc7b42746 (diff) |
Remove spurious "Outgoing messages is invalid" error
-rw-r--r-- | app/controllers/request_controller.rb | 7 | ||||
-rw-r--r-- | config/environment.rb | 9 | ||||
-rw-r--r-- | todo.txt | 2 |
3 files changed, 13 insertions, 5 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 21af0d8b0..e665f690a 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: request_controller.rb,v 1.29 2008-01-04 15:27:18 francis Exp $ +# $Id: request_controller.rb,v 1.30 2008-01-04 16:15:40 francis Exp $ class RequestController < ApplicationController @@ -25,7 +25,7 @@ class RequestController < ApplicationController # Page new form posts to def new - # First time we get to the page, not everything is filled in + # First time we get to the page, just display it if params[:submitted_new_request].nil? # Read parameters in - public body can be passed from front page @info_request = InfoRequest.new(params[:info_request]) @@ -52,6 +52,9 @@ class RequestController < ApplicationController # See if values were valid or not if !@existing_request.nil? || !@info_request.valid? + # We don't want the error "Outgoing messages is invalid", as the outgoing message + # will be valid for a specific reason which we are displaying anyway. + @info_request.errors.delete("outgoing_messages") render :action => 'new' elsif authenticated?( :web => "To send your FOI request", diff --git a/config/environment.rb b/config/environment.rb index 8c1d4387b..426625102 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -120,5 +120,12 @@ module ActionMailer end end - +# Monkeypatch! Remove individual error messages from an ActiveRecord. +module ActiveRecord + class Errors + def delete(key) + @errors.delete(key) + end + end +end @@ -36,8 +36,6 @@ Test that it is actually sending the request outgoing mail, by using deliveries Add fixtures for info_request_event Test sending a message to bounce/envelope-from address -Remove "Outgoing messages is invalid" error - Tidying ======= |