summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-06-20 18:41:30 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-06-20 18:41:30 +0000
commitd2f8feb7c59aea7d76130f47d6c55b39ea88c90d (patch)
treef33aec126db7ed914dd0ece754a334b68405dc9e
parent116c7a7964d6bd8842a11d48ec9e7995d931e710 (diff)
downloadredmine-d2f8feb7c59aea7d76130f47d6c55b39ea88c90d.tar.gz
redmine-d2f8feb7c59aea7d76130f47d6c55b39ea88c90d.zip
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
-rw-r--r--vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb3
1 files changed, 2 insertions, 1 deletions
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 b4ac776ec..e026a6dd4 100644
--- a/vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb
+++ b/vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb
@@ -57,7 +57,8 @@ module Redmine
# Returns an array of watchers' email addresses
def watcher_recipients
- notified = watchers.collect(&:user).select(&:active?)
+ notified = watcher_users.active
+
if respond_to?(:visible?)
notified.reject! {|user| !visible?(user)}
end