プロジェクト

全般

プロフィール

Vote #75444

完了

After copying a task, setting the parent as the orignal task's parent triggers an error

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Issues_2
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
2
version_id:
110
issue_org_id:
17580
author_id:
80618
assigned_to_id:
1
comments:
4
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

Steps for repro:

  1. Create an issue (1), and add a sub-issue (2) to it
  2. Copy this sub-issue (creates issue 3)
  3. Edit issue 3, set issue 1 as its parent Result: We get an error that Parent Issue is invalid
  4. Copy (2), and while in edit mode, define issue 1 as the parent Result: this relationship is accepted
  5. Create sub-issue (4) of issue 1
  6. Display issue 4, add issue 2 as a related issue Result: this relationship is accepted

Expected result: the behavior should be consistent. As far as I'm concerned, I do not see what would justify that "relations" would be forbidden inside the parent-children tree, so the faulty behavior would be the first result (Parent issue invalid) but I might be missing some cases.

Notes :
1) This is related to #12893 (obviously on purpose, see line 216 of app/models/issue.rb:
self.attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on")

2) The current behaviour for 1st result is on purpose: the error message is triggered by line 600 of issue.rb:
elsif (@parent_issue != parent) && (all_dependent_issues.include?(@parent_issue) || @parent_issue.all_dependent_issues.include?(self))

which definitely parses parents, children, cousins, etc., but also related issues.


journals

--------------------------------------------------------------------------------
I fell on this issue again one year later, and so I decided to have a deeper look at the situation.

If we consider that
<pre>
Parent
/ \
Child1 <--> Child2
</pre>
is a circular relationship, then it should be tested when adding a relation as well, and not only when modifying the parent id.
For this, we should add a test in /app/models/issue_relation.rb.

Now, when there is no relation added (Redmine configuration setting set to Do not link copied issues), we should not cancel the copy of the parent_id, as mentioned in #12893. For this, I suggest to take this setting into account and copy the parent_id attribute conditionally.

I attached a patch which implements those remarks.

You will note that the failure of adding the link after saving the copied issue (which comes after validation, and therefore relies on a different validation than when changing the parent_id), results only in an ERROR in the log, and not in a flashed error. Feel free to modify this behavior if you feel this is necessary.

Could this come into a release soon?
Thanks

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
This is fixed as part of #13654, test added in r15057.
--------------------------------------------------------------------------------


related_issues

relates,Closed,12893,Copying an issue does not copy parent task id
relates,Closed,13654,Can't set parent issue when issue relations among child issues are present

Admin Redmine さんが約4年前に更新

  • カテゴリIssues_2 にセット
  • 対象バージョン3.3.0_110 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0