@@ -1386,7 +1386,7 class Issue < ActiveRecord::Base | |||||
1386 | if current_project |
|
1386 | if current_project | |
1387 | condition = ["(#{condition}) OR #{Project.table_name}.id = ?", current_project.id] |
|
1387 | condition = ["(#{condition}) OR #{Project.table_name}.id = ?", current_project.id] | |
1388 | end |
|
1388 | end | |
1389 | Project.where(condition) |
|
1389 | Project.where(condition).having_trackers | |
1390 | end |
|
1390 | end | |
1391 |
|
1391 | |||
1392 | private |
|
1392 | private |
@@ -110,6 +110,9 class Project < ActiveRecord::Base | |||||
110 | end |
|
110 | end | |
111 | } |
|
111 | } | |
112 | scope :sorted, lambda {order(:lft)} |
|
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 | def initialize(attributes=nil, *args) |
|
117 | def initialize(attributes=nil, *args) | |
115 | super |
|
118 | super |
@@ -1331,6 +1331,12 class IssueTest < ActiveSupport::TestCase | |||||
1331 | assert_not_include Project.find(2), Issue.allowed_target_projects(User.find(2)) |
|
1331 | assert_not_include Project.find(2), Issue.allowed_target_projects(User.find(2)) | |
1332 | end |
|
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 | def test_move_to_another_project_with_same_category |
|
1340 | def test_move_to_another_project_with_same_category | |
1335 | issue = Issue.find(1) |
|
1341 | issue = Issue.find(1) | |
1336 | issue.project = Project.find(2) |
|
1342 | issue.project = Project.find(2) |
General Comments 0
You need to be logged in to leave comments.
Login now