Optimize the N+1 query in watcher_recipients. #5415

Contributed by Holger Just

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3803 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis 2010-06-20 18:41:30 +00:00
parent 116c7a7964
commit d2f8feb7c5
1 changed files with 2 additions and 1 deletions

View File

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