diff options
-rw-r--r-- | app/controllers/issues_controller.rb | 10 | ||||
-rw-r--r-- | test/functional/issues_controller_test.rb | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 686a6b47f..d3dd2d504 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 @@ -484,7 +490,7 @@ class IssuesController < ApplicationController render_error l(:error_no_default_issue_status) return false end - else + elsif request.get? render_error :message => l(:error_no_projects_with_tracker_allowed_for_new_issue), :status => 403 return false end diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index e4c6cd234..45605bd9e 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -2558,7 +2558,7 @@ class IssuesControllerTest < Redmine::ControllerTest :issue => {:project_id => 3, :tracker_id => 2, :subject => 'Foo'} - assert_response 403 + assert_response 422 end end |