diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-03-17 15:02:57 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-03-17 15:02:57 +0000 |
commit | 38b3e045cf221e8d1aad1ea7fd9e2a86ea0ff5f6 (patch) | |
tree | 374354c3d09066ec44a8bb8881a6bd5afc5e2bb1 /app/models | |
parent | b1afd75620529f855a83bf1202c9dfb630258568 (diff) | |
download | redmine-38b3e045cf221e8d1aad1ea7fd9e2a86ea0ff5f6.tar.gz redmine-38b3e045cf221e8d1aad1ea7fd9e2a86ea0ff5f6.zip |
Fixed: Circular loop when using relations and subtasks (#8794).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11641 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/issue.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index aed727ae0..3b4c79def 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -576,6 +576,8 @@ class Issue < ActiveRecord::Base elsif @parent_issue if !valid_parent_project?(@parent_issue) errors.add :parent_issue_id, :invalid + elsif (@parent_issue != parent) && (all_dependent_issues.include?(@parent_issue) || @parent_issue.all_dependent_issues.include?(self)) + errors.add :parent_issue_id, :invalid elsif !new_record? # moving an existing issue if @parent_issue.root_id != root_id @@ -860,6 +862,18 @@ class Issue < ActiveRecord::Base dependencies += relation.issue_to.all_dependent_issues(except) end end + unless leaf? + children.each do |child| + if !except.include?(child) + dependencies << child + dependencies += child.all_dependent_issues(except) + end + end + end + if parent && !except.include?(parent) + dependencies << parent + dependencies += parent.all_dependent_issues(except) + end dependencies end |