summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-03-20 16:27:09 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-03-20 16:27:09 +0000
commitea099fb771a85c1350b92ed05aac9325370e7b5f (patch)
tree575656950813ba91b6cbf0442820350179cb99d3
parent98c28b467b30e89dbec68c2f0964b87c86b46a0b (diff)
downloadredmine-ea099fb771a85c1350b92ed05aac9325370e7b5f.tar.gz
redmine-ea099fb771a85c1350b92ed05aac9325370e7b5f.zip
Don't render the issue form if issue.project is nil (#19276).
git-svn-id: http://svn.redmine.org/redmine/trunk@14146 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/controllers/issues_controller.rb8
-rw-r--r--test/functional/issues_controller_test.rb2
2 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 15f26e273..d38b69dd1 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -151,7 +151,13 @@ class IssuesController < ApplicationController
return
else
respond_to do |format|
- format.html { render :action => 'new' }
+ format.html {
+ if @issue.project.nil?
+ render_error :status => 422
+ else
+ render :action => 'new'
+ end
+ }
format.api { render_validation_errors(@issue) }
end
end
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 70e74baa5..dc3bd4861 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -2218,7 +2218,7 @@ class IssuesControllerTest < ActionController::TestCase
:issue => {:project_id => 3,
:tracker_id => 2,
:subject => 'Foo'}
- assert_response 403
+ assert_response 422
end
end