Fixed: Email notifications are sent to watchers even if 'No events' setting is chosen (#7763).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5004 e93f8b46-1217-0410-a6f0-8f06a7374b81
pull/351/head
Jean-Philippe Lang 14 years ago committed by Eric Davis
parent 6f5707c2b5
commit dac912b379
  1. 10
      test/unit/watcher_test.rb
  2. 3
      vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb

@ -60,15 +60,15 @@ class WatcherTest < ActiveSupport::TestCase
assert @issue.watcher_recipients.empty? assert @issue.watcher_recipients.empty?
assert @issue.add_watcher(@user) assert @issue.add_watcher(@user)
@user.mail_notification = true @user.mail_notification = 'all'
@user.save @user.save!
@issue.reload @issue.reload
assert @issue.watcher_recipients.include?(@user.mail) assert @issue.watcher_recipients.include?(@user.mail)
@user.mail_notification = false @user.mail_notification = 'none'
@user.save @user.save!
@issue.reload @issue.reload
assert @issue.watcher_recipients.include?(@user.mail) assert !@issue.watcher_recipients.include?(@user.mail)
end end
def test_unwatch def test_unwatch

@ -58,7 +58,8 @@ module Redmine
# Returns an array of watchers' email addresses # Returns an array of watchers' email addresses
def watcher_recipients def watcher_recipients
notified = watcher_users.active notified = watcher_users.active
notified.reject! {|user| user.mail_notification == 'none'}
if respond_to?(:visible?) if respond_to?(:visible?)
notified.reject! {|user| !visible?(user)} notified.reject! {|user| !visible?(user)}
end end

Loading…
Cancel
Save