diff options
author | Matthew Landauer <matthew@openaustralia.org> | 2013-03-22 14:22:26 +1100 |
---|---|---|
committer | Matthew Landauer <matthew@openaustralia.org> | 2013-03-22 14:22:26 +1100 |
commit | 06c1d5844c7da1f03acb930afe29f6c7221c62ba (patch) | |
tree | ca2f048aa657b99b0d19d5632df68f24d007efc1 | |
parent | 01a8eed6e9aec5b2539ed9afe1d198972d0c96ec (diff) |
Posted reason and message gets sent out in the email
-rw-r--r-- | app/controllers/request_controller.rb | 2 | ||||
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index dc8db4ab1..a018d76c9 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -689,7 +689,7 @@ class RequestController < ApplicationController ) if !info_request.attention_requested - info_request.set_described_state('attention_requested', @user) + info_request.set_described_state('attention_requested', @user, "Reason: #{params[:reason]}\n\n#{params[:message]}") info_request.attention_requested = true # tells us if attention has ever been requested info_request.save! flash[:notice] = _("This request has been reported for administrator attention") diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 02a013906..d73fb89c7 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -2329,6 +2329,13 @@ describe RequestController, "when reporting a request (logged in)" do assigns[:info_request].described_state.should == "attention_requested" end + it "should pass on the reason and message" do + info_request = mock_model(InfoRequest, :url_title => "foo", :attention_requested= => nil, :save! => nil) + InfoRequest.should_receive(:find_by_url_title!).with("foo").and_return(info_request) + info_request.should_receive(:set_described_state).with("attention_requested", @user, "Reason: Not valid request\n\nIt's just not") + post :report_request, :url_title => "foo", :reason => "Not valid request", :message => "It's just not" + end + it "should not allow a request to be reported twice" do title = info_requests(:badger_request).url_title |