Fixed that project overview page shows trackers from subprojects with disabled issue module (#13076).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11336 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
1fe29c8a0c
commit
0f2ee79f35
|
@ -416,6 +416,7 @@ class Project < ActiveRecord::Base
|
||||||
@rolled_up_trackers ||=
|
@rolled_up_trackers ||=
|
||||||
Tracker.
|
Tracker.
|
||||||
joins(:projects).
|
joins(:projects).
|
||||||
|
joins("JOIN #{EnabledModule.table_name} ON #{EnabledModule.table_name}.project_id = #{Project.table_name}.id AND #{EnabledModule.table_name}.name = 'issue_tracking'", ).
|
||||||
select("DISTINCT #{Tracker.table_name}.*").
|
select("DISTINCT #{Tracker.table_name}.*").
|
||||||
where("#{Project.table_name}.lft >= ? AND #{Project.table_name}.rgt <= ? AND #{Project.table_name}.status <> #{STATUS_ARCHIVED}", lft, rgt).
|
where("#{Project.table_name}.lft >= ? AND #{Project.table_name}.rgt <= ? AND #{Project.table_name}.status <> #{STATUS_ARCHIVED}", lft, rgt).
|
||||||
sorted.
|
sorted.
|
||||||
|
|
|
@ -434,6 +434,19 @@ class ProjectTest < ActiveSupport::TestCase
|
||||||
assert_equal [1,2], parent.rolled_up_trackers.collect(&:id)
|
assert_equal [1,2], parent.rolled_up_trackers.collect(&:id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "#rolled_up_trackers should ignore projects with issue_tracking module disabled" do
|
||||||
|
parent = Project.generate!
|
||||||
|
parent.trackers = Tracker.find([1, 2])
|
||||||
|
child = Project.generate_with_parent!(parent)
|
||||||
|
child.trackers = Tracker.find([2, 3])
|
||||||
|
|
||||||
|
assert_equal [1, 2, 3], parent.rolled_up_trackers.collect(&:id).sort
|
||||||
|
|
||||||
|
assert child.disable_module!(:issue_tracking)
|
||||||
|
parent.reload
|
||||||
|
assert_equal [1, 2], parent.rolled_up_trackers.collect(&:id).sort
|
||||||
|
end
|
||||||
|
|
||||||
test "#rolled_up_versions should include the versions for the current project" do
|
test "#rolled_up_versions should include the versions for the current project" do
|
||||||
project = Project.generate!
|
project = Project.generate!
|
||||||
parent_version_1 = Version.generate!(:project => project)
|
parent_version_1 = Version.generate!(:project => project)
|
||||||
|
|
Loading…
Reference in New Issue