From: Eric Davis Date: Sun, 20 Jun 2010 18:41:30 +0000 (+0000) Subject: Optimize the N+1 query in watcher_recipients. #5415 X-Git-Tag: 1.0.0~40 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d2f8feb7c59aea7d76130f47d6c55b39ea88c90d;p=redmine.git 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 --- 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