##// END OF EJS Templates
Don't propose projects without trackers when editing an issue (#20463)....
Jean-Philippe Lang -
r14231:671fce04dec6
parent child
Show More
@@ -1386,7 +1386,7 class Issue < ActiveRecord::Base
1386 1386 if current_project
1387 1387 condition = ["(#{condition}) OR #{Project.table_name}.id = ?", current_project.id]
1388 1388 end
1389 Project.where(condition)
1389 Project.where(condition).having_trackers
1390 1390 end
1391 1391
1392 1392 private
@@ -110,6 +110,9 class Project < ActiveRecord::Base
110 110 end
111 111 }
112 112 scope :sorted, lambda {order(:lft)}
113 scope :having_trackers, lambda {
114 where("#{Project.table_name}.id IN (SELECT DISTINCT project_id FROM #{table_name_prefix}projects_trackers#{table_name_suffix})")
115 }
113 116
114 117 def initialize(attributes=nil, *args)
115 118 super
@@ -1331,6 +1331,12 class IssueTest < ActiveSupport::TestCase
1331 1331 assert_not_include Project.find(2), Issue.allowed_target_projects(User.find(2))
1332 1332 end
1333 1333
1334 def test_allowed_target_projects_should_not_include_projects_without_trackers
1335 project = Project.generate!(:tracker_ids => [])
1336 assert project.trackers.empty?
1337 assert_not_include project, Issue.allowed_target_projects(User.find(1))
1338 end
1339
1334 1340 def test_move_to_another_project_with_same_category
1335 1341 issue = Issue.find(1)
1336 1342 issue.project = Project.find(2)
General Comments 0
You need to be logged in to leave comments. Login now