プロジェクト

全般

プロフィール

Vote #79308

完了

Copying an issue fails if the issue is watched by a locked user

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

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

0%

予定工数:
category_id:
2
version_id:
141
issue_org_id:
28765
author_id:
351306
assigned_to_id:
332
comments:
11
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

When copying the parent issue having child issue, some issues could not be copied.
The "Copy subtasks" checkbox is checked.

After checking the log, it turned out that only the issue for which the member of the lock account is set to the watcher has not been copied.
Even if the members of the lock account are set on the watcher, I want you to be able to copy the issue.

Redmine version:3.4.2
rudy version:2.3.3-p222
Rails version:4.2.8

I will post it for the first time. I'm sorry if I made a mistake in my way.


journals

I confirmed the problem. Copying an issue fails if the issue is watched by a locked user and a validation error "Watchers is invalid" is displayed.

> I will post it for the first time. I'm sorry if I made a mistake in my way.

There was no problem at all. Thank you for reporting this issue.

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

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

--------------------------------------------------------------------------------
Attached is a patch with a test included that fixes this issue. I chose to propose in the UI only active users as watchers when copying an issue.

--------------------------------------------------------------------------------
Thank you for working on this issue, Marius. I confirmed that the patch fixes the problem.

But I noticed that inactive users should be excluded not only in the UI but also in Issue#copy_from method because there still be a problem even after applying the patch. Issues which have locked watchers are not copied when admins use project copy feature.

What do you think including the following code in your patch?

<pre><code class="diff">
Index: app/models/issue.rb
===================================================================
--- app/models/issue.rb (revision 17329)
+++ app/models/issue.rb (working copy)
@@ -274,7 +274,8 @@
end
end
unless options[:watchers] == false
- self.watcher_user_ids = issue.watcher_user_ids.dup
+ self.watcher_user_ids =
+ issue.watcher_users.select{|u| u.status == User::STATUS_ACTIVE}.map(&:id)
end
@copied_from = issue
@copy_options = options
</code></pre>
--------------------------------------------------------------------------------
Oh, I didn't think to this case, thanks for finding it.

It looks good and I made a unit test also for this scenario (attached).
--------------------------------------------------------------------------------
Marius BALTEANU wrote:
> It looks good and I made a unit test also for this scenario (attached).

Great, the patch looks perfect now. I am setting target version to 3.4.6. The patches to be committed are as follows:

* attachment:0001-do-not-propose-locked-watchers-when-copying-an-issue.patch
* #28765#note-5
* attachment:0001-unit-test-for-locked-watchers.patch
--------------------------------------------------------------------------------
In the unit test patch, the name of the test method is misspelled. This typo is fixed in the attached patch.
--------------------------------------------------------------------------------
Andreas Deininger wrote:
> In the unit test patch, the name of the test method is misspelled. This typo is fixed in the attached patch.

Thank you for pointing out that "shoud" should be "should".

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

--------------------------------------------------------------------------------
Committed to the trunk and 3.4-stable branch. Thank you all for reporting and fixing this issue.
--------------------------------------------------------------------------------


related_issues

relates,Closed,27863,If version is closed or locked subtasks don't get copied

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

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

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

いいね!0
いいね!0