##// END OF EJS Templates
Refactor: Move recipients method into acts_as_event...
Eric Davis -
r3244:358e3194d79b
parent child
Show More
@@ -46,11 +46,4 class Document < ActiveRecord::Base
46 end
46 end
47 @updated_on
47 @updated_on
48 end
48 end
49
50 # Returns the mail adresses of users that should be notified
51 def recipients
52 notified = project.notified_users
53 notified.reject! {|user| !visible?(user)}
54 notified.collect(&:mail)
55 end
56 end
49 end
@@ -90,13 +90,6 class Message < ActiveRecord::Base
90 usr && usr.logged? && (usr.allowed_to?(:delete_messages, project) || (self.author == usr && usr.allowed_to?(:delete_own_messages, project)))
90 usr && usr.logged? && (usr.allowed_to?(:delete_messages, project) || (self.author == usr && usr.allowed_to?(:delete_own_messages, project)))
91 end
91 end
92
92
93 # Returns the mail adresses of users that should be notified
94 def recipients
95 notified = project.notified_users
96 notified.reject! {|user| !visible?(user)}
97 notified.collect(&:mail)
98 end
99
100 private
93 private
101
94
102 def add_author_as_watcher
95 def add_author_as_watcher
@@ -33,13 +33,6 class News < ActiveRecord::Base
33 !user.nil? && user.allowed_to?(:view_news, project)
33 !user.nil? && user.allowed_to?(:view_news, project)
34 end
34 end
35
35
36 # Returns the mail adresses of users that should be notified
37 def recipients
38 notified = project.notified_users
39 notified.reject! {|user| !visible?(user)}
40 notified.collect(&:mail)
41 end
42
43 # returns latest news for projects visible by user
36 # returns latest news for projects visible by user
44 def self.latest(user = User.current, count = 5)
37 def self.latest(user = User.current, count = 5)
45 find(:all, :limit => count, :conditions => Project.allowed_to_condition(user, :view_news), :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
38 find(:all, :limit => count, :conditions => Project.allowed_to_condition(user, :view_news), :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
@@ -68,6 +68,13 module Redmine
68 (option.is_a?(Proc) ? option.call(self) : send(option)).merge(options)
68 (option.is_a?(Proc) ? option.call(self) : send(option)).merge(options)
69 end
69 end
70
70
71 # Returns the mail adresses of users that should be notified
72 def recipients
73 notified = project.notified_users
74 notified.reject! {|user| !visible?(user)}
75 notified.collect(&:mail)
76 end
77
71 module ClassMethods
78 module ClassMethods
72 end
79 end
73 end
80 end
General Comments 0
You need to be logged in to leave comments. Login now