From 4d0a955d3c86f4dbedca796aeb3f0c7e73b97a8b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 6 Mar 2011 12:48:40 +0000 Subject: [PATCH] Merged r5004 from trunk. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.1-stable@5012 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/watcher_test.rb | 10 +++++----- .../plugins/acts_as_watchable/lib/acts_as_watchable.rb | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/test/unit/watcher_test.rb b/test/unit/watcher_test.rb index 48c303135..86d96b2cb 100644 --- a/test/unit/watcher_test.rb +++ b/test/unit/watcher_test.rb @@ -60,15 +60,15 @@ class WatcherTest < ActiveSupport::TestCase assert @issue.watcher_recipients.empty? assert @issue.add_watcher(@user) - @user.mail_notification = true - @user.save + @user.mail_notification = 'all' + @user.save! @issue.reload assert @issue.watcher_recipients.include?(@user.mail) - @user.mail_notification = false - @user.save + @user.mail_notification = 'none' + @user.save! @issue.reload - assert @issue.watcher_recipients.include?(@user.mail) + assert !@issue.watcher_recipients.include?(@user.mail) end def test_unwatch diff --git a/vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb b/vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb index e026a6dd4..61196d9a8 100644 --- a/vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb +++ b/vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb @@ -58,7 +58,8 @@ module Redmine # Returns an array of watchers' email addresses def watcher_recipients notified = watcher_users.active - + notified.reject! {|user| user.mail_notification == 'none'} + if respond_to?(:visible?) notified.reject! {|user| !visible?(user)} end -- 2.39.5