diff options
author | Jean-Baptiste Barth <jeanbaptiste.barth@gmail.com> | 2011-06-26 12:47:15 +0000 |
---|---|---|
committer | Jean-Baptiste Barth <jeanbaptiste.barth@gmail.com> | 2011-06-26 12:47:15 +0000 |
commit | f982c5b90d5258196774bccfa6a4c587f2a878c5 (patch) | |
tree | 08a6b35b013666df80e564010cb30b003fec166a /app/models/issue_relation.rb | |
parent | ee527ab47c3f94dd7853a586b14314b456ffa553 (diff) | |
download | redmine-f982c5b90d5258196774bccfa6a4c587f2a878c5.tar.gz redmine-f982c5b90d5258196774bccfa6a4c587f2a878c5.zip |
Fixed circular dependencies possibly introduced when using reverse relations, for instance "blocked by" relations (#8616).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6124 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue_relation.rb')
-rw-r--r-- | app/models/issue_relation.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/issue_relation.rb b/app/models/issue_relation.rb index 8f2db40f3..751ac3579 100644 --- a/app/models/issue_relation.rb +++ b/app/models/issue_relation.rb @@ -47,7 +47,12 @@ class IssueRelation < ActiveRecord::Base if issue_from && issue_to errors.add :issue_to_id, :invalid if issue_from_id == issue_to_id errors.add :issue_to_id, :not_same_project unless issue_from.project_id == issue_to.project_id || Setting.cross_project_issue_relations? - errors.add_to_base :circular_dependency if issue_to.all_dependent_issues.include? issue_from + #detect circular dependencies depending wether the relation should be reversed + if TYPES.has_key?(relation_type) && TYPES[relation_type][:reverse] + errors.add_to_base :circular_dependency if issue_from.all_dependent_issues.include? issue_to + else + errors.add_to_base :circular_dependency if issue_to.all_dependent_issues.include? issue_from + end errors.add_to_base :cant_link_an_issue_with_a_descendant if issue_from.is_descendant_of?(issue_to) || issue_from.is_ancestor_of?(issue_to) end end |