Mercurial > hg > soundsoftware-site
diff vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb @ 441:cbce1fd3b1b7 redmine-1.2
Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author | Chris Cannam |
---|---|
date | Mon, 06 Jun 2011 14:24:13 +0100 |
parents | 513646585e45 |
children |
line wrap: on
line diff
--- a/vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb Thu Mar 03 11:42:28 2011 +0000 +++ b/vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb Mon Jun 06 14:24:13 2011 +0100 @@ -13,7 +13,7 @@ class_eval do has_many :watchers, :as => :watchable, :dependent => :delete_all - has_many :watcher_users, :through => :watchers, :source => :user + has_many :watcher_users, :through => :watchers, :source => :user, :validate => false named_scope :watched_by, lambda { |user_id| { :include => :watchers, @@ -31,7 +31,11 @@ # Returns an array of users that are proposed as watchers def addable_watcher_users - self.project.users.sort - self.watcher_users + users = self.project.users.sort - self.watcher_users + if respond_to?(:visible?) + users.reject! {|user| !visible?(user)} + end + users end # Adds user as a watcher @@ -58,7 +62,8 @@ # 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