]> source.dussan.org Git - redmine.git/commitdiff
Moves watchers filtering logic to ActsAsWatchable.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 13 Dec 2009 13:06:57 +0000 (13:06 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 13 Dec 2009 13:06:57 +0000 (13:06 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3168 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue.rb
vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb

index a550779cd7ef0a95a0907e84659d0c7e3191a8a5..b9e0461029b383dd28c4e71b40d3c611e268e2c0 100644 (file)
@@ -314,13 +314,6 @@ class Issue < ActiveRecord::Base
     notified.collect(&:mail)
   end
   
-  # Returns the mail adresses of watchers that should be notified
-  def watcher_recipients
-    notified = watcher_users
-    notified.reject! {|user| !user.active? || !visible?(user)}
-    notified.collect(&:mail)
-  end
-  
   # Returns the total number of hours spent on this issue.
   #
   # Example:
index 977ab4fc7dcf17d641ffe87f50a6db1a7b525e0d..c13da4fd4665e15e81cee8bfafffe0136fca6096 100644 (file)
@@ -53,7 +53,11 @@ module Redmine
         
         # Returns an array of watchers' email addresses
         def watcher_recipients
-          self.watchers.collect { |w| w.user.mail if w.user.active? }.compact
+          notified = watchers.collect(&:user).select(&:active?)
+          if respond_to?(:visible?)
+            notified.reject! {|user| !visible?(user)}
+          end
+          notified.collect(&:mail).compact
         end
 
         module ClassMethods