Fixed that r11641 prevents precedes/follows relations between subtasks (#13586).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11692 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
de68231632
commit
ed5b14884c
|
@ -859,10 +859,14 @@ class Issue < ActiveRecord::Base
|
||||||
dependencies = []
|
dependencies = []
|
||||||
dependencies += relations_from.map(&:issue_to)
|
dependencies += relations_from.map(&:issue_to)
|
||||||
dependencies += children unless leaf?
|
dependencies += children unless leaf?
|
||||||
dependencies << parent
|
|
||||||
dependencies.compact!
|
dependencies.compact!
|
||||||
dependencies -= except
|
dependencies -= except
|
||||||
dependencies + dependencies.map {|issue| issue.all_dependent_issues(except)}.flatten
|
dependencies += dependencies.map {|issue| issue.all_dependent_issues(except)}.flatten
|
||||||
|
if parent
|
||||||
|
dependencies << parent
|
||||||
|
dependencies += parent.all_dependent_issues(except + parent.descendants)
|
||||||
|
end
|
||||||
|
dependencies
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns an array of issues that duplicate this one
|
# Returns an array of issues that duplicate this one
|
||||||
|
|
|
@ -137,6 +137,19 @@ class IssueRelationTest < ActiveSupport::TestCase
|
||||||
assert_include 'This relation would create a circular dependency', r.errors.full_messages
|
assert_include 'This relation would create a circular dependency', r.errors.full_messages
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_subtasks_should_allow_precedes_relation
|
||||||
|
parent = Issue.generate!
|
||||||
|
child1 = Issue.generate!(:parent_issue_id => parent.id)
|
||||||
|
child2 = Issue.generate!(:parent_issue_id => parent.id)
|
||||||
|
|
||||||
|
r = IssueRelation.new(
|
||||||
|
:issue_from => child1, :issue_to => child2,
|
||||||
|
:relation_type => IssueRelation::TYPE_PRECEDES
|
||||||
|
)
|
||||||
|
assert r.valid?
|
||||||
|
assert r.save
|
||||||
|
end
|
||||||
|
|
||||||
def test_validates_circular_dependency_on_reverse_relations
|
def test_validates_circular_dependency_on_reverse_relations
|
||||||
IssueRelation.delete_all
|
IssueRelation.delete_all
|
||||||
assert IssueRelation.create!(
|
assert IssueRelation.create!(
|
||||||
|
|
Loading…
Reference in New Issue