From ea099fb771a85c1350b92ed05aac9325370e7b5f Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 20 Mar 2015 16:27:09 +0000 Subject: [PATCH] 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 --- app/controllers/issues_controller.rb | 8 +++++++- test/functional/issues_controller_test.rb | 2 +- 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 -- 2.39.5