]> source.dussan.org Git - redmine.git/commitdiff
Don't render the issue form if issue.project is nil (#19276).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 20 Mar 2015 16:27:09 +0000 (16:27 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 20 Mar 2015 16:27:09 +0000 (16:27 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@14146 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/issues_controller.rb
test/functional/issues_controller_test.rb

index 15f26e27331af3884db5dfd3383666c46b30f8b8..d38b69dd1a0bfada189ca795746399502bbd990f 100644 (file)
@@ -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
index 70e74baa5262a0bad22be83412b97137317330fe..dc3bd4861bdd2b129fe421f3ab070a33d54a446b 100644 (file)
@@ -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