Revision 442:753f1380d6bc vendor/plugins/acts_as_watchable/lib/.svn/text-base

View differences:

vendor/plugins/acts_as_watchable/lib/.svn/text-base/acts_as_watchable.rb.svn-base
13 13
          
14 14
          class_eval do
15 15
            has_many :watchers, :as => :watchable, :dependent => :delete_all
16
            has_many :watcher_users, :through => :watchers, :source => :user
16
            has_many :watcher_users, :through => :watchers, :source => :user, :validate => false
17 17
            
18 18
            named_scope :watched_by, lambda { |user_id|
19 19
              { :include => :watchers,
......
31 31
        
32 32
        # Returns an array of users that are proposed as watchers
33 33
        def addable_watcher_users
34
          self.project.users.sort - self.watcher_users
34
          users = self.project.users.sort - self.watcher_users
35
          if respond_to?(:visible?)
36
            users.reject! {|user| !visible?(user)}
37
          end
38
          users
35 39
        end
36 40
        
37 41
        # Adds user as a watcher
......
58 62
        # Returns an array of watchers' email addresses
59 63
        def watcher_recipients
60 64
          notified = watcher_users.active
61

  
65
          notified.reject! {|user| user.mail_notification == 'none'}
66
          
62 67
          if respond_to?(:visible?)
63 68
            notified.reject! {|user| !visible?(user)}
64 69
          end

Also available in: Unified diff