summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2018-05-19 00:44:10 +0000
committerGo MAEDA <maeda@farend.jp>2018-05-19 00:44:10 +0000
commit2943153ecaa463487b7f0e6bdcbdfe0e57aabab6 (patch)
treeefac7945c37e40ae6e1b0ac54eab810eb080c737 /test/unit/issue_test.rb
parent7832ca683acead2491c8c7d1106c18a68e545ef0 (diff)
downloadredmine-2943153ecaa463487b7f0e6bdcbdfe0e57aabab6.tar.gz
redmine-2943153ecaa463487b7f0e6bdcbdfe0e57aabab6.zip
Fix: Copying an issue fails if the issue is watched by a locked user (#28765).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@17342 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_test.rb')
-rw-r--r--test/unit/issue_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index 880c0a606..48a12c6e4 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -1375,6 +1375,24 @@ class IssueTest < ActiveSupport::TestCase
assert_not_nil copied_closed.closed_on
end
+ def test_copy_should_not_copy_locked_watchers
+ user = User.find(2)
+ user2 = User.find(3)
+ issue = Issue.find(8)
+
+ Watcher.create!(:user => user, :watchable => issue)
+ Watcher.create!(:user => user2, :watchable => issue)
+
+ user2.status = User::STATUS_LOCKED
+ user2.save!
+
+ issue = Issue.new.copy_from(8)
+
+ assert issue.save
+ assert issue.watched_by?(user)
+ assert !issue.watched_by?(user2)
+ end
+
def test_should_not_call_after_project_change_on_creation
issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
:subject => 'Test', :author_id => 1)