Support removing assigned_user from watchers
This commit is contained in:
parent
41f9f2f710
commit
1f41f55097
@ -4,6 +4,7 @@ Changelog
|
||||
2.0.3 (no version bump/tag at the moment)
|
||||
+++++
|
||||
|
||||
- Allow remove watchers without re-adding it (only if author or assigned_user changed)
|
||||
- Fix sort order of users for change author
|
||||
|
||||
2.0.2
|
||||
|
@ -34,9 +34,12 @@ module Additionals
|
||||
def autowatch_involved
|
||||
return unless Additionals.settings[:issue_autowatch_involved].to_i == 1
|
||||
|
||||
add_autowatcher(author) if new_record? || author_id != author_id_was
|
||||
add_autowatcher(User.current)
|
||||
add_autowatcher(assigned_to) unless assigned_to.nil? || assigned_to.id == User.current.id
|
||||
add_autowatcher(author) if new_record? || author_id != author_id_was
|
||||
unless assigned_to_id.nil? || assigned_to_id == User.current.id
|
||||
#raise "assigned_to_id: #{assigned_to_id.inspect} - #{assigned_to_id_was.inspect}"
|
||||
add_autowatcher(assigned_to) if new_record? || assigned_to_id != assigned_to_id_was
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
|
@ -1,10 +1,8 @@
|
||||
require 'simplecov'
|
||||
require 'simplecov-rcov'
|
||||
|
||||
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
||||
SimpleCov::Formatter::HTMLFormatter,
|
||||
SimpleCov::Formatter::RcovFormatter
|
||||
]
|
||||
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter[SimpleCov::Formatter::HTMLFormatter,
|
||||
SimpleCov::Formatter::RcovFormatter]
|
||||
|
||||
SimpleCov.start :rails do
|
||||
add_filter 'init.rb'
|
||||
|
@ -50,4 +50,24 @@ class WatcherTest < ActiveSupport::TestCase
|
||||
assert issue.watched_by?(@changing_user)
|
||||
assert issue.watched_by?(@assigned_user)
|
||||
end
|
||||
|
||||
def test_issue_do_not_add_assigned_to_with_user_change
|
||||
User.current = @author
|
||||
|
||||
issue = Issue.generate(author_id: @author.id, assigned_to: @assigned_user)
|
||||
issue.save
|
||||
assert_equal 2, issue.watchers.count
|
||||
|
||||
issue.remove_watcher(@assigned_user)
|
||||
issue.reload
|
||||
assert_equal 1, issue.watchers.count
|
||||
|
||||
User.current = @changing_user
|
||||
issue.subject = 'Changing....'
|
||||
issue.save
|
||||
|
||||
assert_equal 2, issue.watchers.count
|
||||
assert issue.watched_by?(@author)
|
||||
assert issue.watched_by?(@changing_user)
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user