From: Jean-Philippe Lang Date: Fri, 20 Mar 2015 16:27:09 +0000 (+0000) Subject: Don't render the issue form if issue.project is nil (#19276). X-Git-Tag: 3.1.0~177 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ea099fb771a85c1350b92ed05aac9325370e7b5f;p=redmine.git 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 --- 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