]> source.dussan.org Git - redmine.git/commitdiff
Fix project selector on global new issue page not showing all visible projects (...
authorGo MAEDA <maeda@farend.jp>
Mon, 1 Feb 2021 04:22:22 +0000 (04:22 +0000)
committerGo MAEDA <maeda@farend.jp>
Mon, 1 Feb 2021 04:22:22 +0000 (04:22 +0000)
Patch by Marius BALTEANU.

git-svn-id: http://svn.redmine.org/redmine/trunk@20733 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/issues_helper.rb
test/functional/issues_controller_test.rb

index 20a708ca045a8cf307e5c2db1de6497cff710801..566cd1d53201b198a352c437aea942bb4f64fc3a 100644 (file)
@@ -746,7 +746,7 @@ module IssuesHelper
   def projects_for_select(issue)
     if issue.parent_issue_id.present?
       issue.allowed_target_projects_for_subtask(User.current)
-    elsif issue.new_record? && !issue.copy?
+    elsif @project && issue.new_record? && !issue.copy?
       issue.allowed_target_projects(User.current, 'descendants')
     else
       issue.allowed_target_projects(User.current)
index 1762c7efd81b97c9b2792a26b898dcf916971486..a8296b9bc37f27a897104050b7c4e7988cd4407d 100644 (file)
@@ -3170,6 +3170,18 @@ class IssuesControllerTest < Redmine::ControllerTest
     end
   end
 
+  def test_get_new_global_should_show_all_projects
+    @request.session[:user_id] = 1
+    get :new
+
+    assert_response :success
+
+    assert_select 'select[name=?]', 'issue[project_id]' do
+      assert_select 'option[value=?]', '1'
+      assert_select 'option[value=?]', '2'
+    end
+  end
+
   def test_get_new_should_show_project_selector_for_project_with_subprojects
     @request.session[:user_id] = 2
     get(