]> source.dussan.org Git - redmine.git/commitdiff
Merged r11692 from trunk (#13586).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 3 Apr 2013 17:04:40 +0000 (17:04 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 3 Apr 2013 17:04:40 +0000 (17:04 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.3-stable@11697 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue.rb
test/unit/issue_relation_test.rb

index d93cca8bbfcfefbf6f2e6abf3751c8386867953c..72d31cedb84ca1a01d2020181a29fabae7c10e77 100644 (file)
@@ -859,10 +859,14 @@ class Issue < ActiveRecord::Base
     dependencies = []
     dependencies += relations_from.map(&:issue_to)
     dependencies += children unless leaf?
-    dependencies << parent
     dependencies.compact!
     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
 
   # Returns an array of issues that duplicate this one
index f15a74c34021bcceb580f0d44fed2702782c11a6..f0e74faf7dcc1807be921090dff3c8e614cb3dad 100644 (file)
@@ -137,6 +137,19 @@ class IssueRelationTest < ActiveSupport::TestCase
     assert_include 'This relation would create a circular dependency', r.errors.full_messages
   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
     IssueRelation.delete_all
     assert IssueRelation.create!(