--- app/models/issue.rb 2015-07-07 21:47:00.000000000 +0200 +++ /usr/share/redmine/app/models/issue.rb 2015-08-11 19:41:57.408794526 +0200 @@ -615,7 +632,16 @@ 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 + if all_dependent_issues.include?(@parent_issue) + # this would create a loop, don't like that! - new parent is a child or sub child of me + errors.add :parent_issue_id, "loop prevention #{@parent_issue} is a direct or indirect child of this topic" + end + parent_dependencies = @parent_issue.all_dependent_issues + if parent_dependencies.include?(self) + # a child of this topic is also a child of the new parent + f=parent_dependencies[0]; + errors.add :parent_issue_id, "an issue depending on the new parent also depends on this issue: #{f}" + end elsif !new_record? # moving an existing issue if @parent_issue.root_id != root_id