Refactor: Move recipients method into acts_as_event
acts_as_event should be the standard interface to Redmine events, like mail notifications, so having a standard recipients implementation there makes sense. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3358 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
d43c860448
commit
358e3194d7
|
@ -46,11 +46,4 @@ class Document < ActiveRecord::Base
|
|||
end
|
||||
@updated_on
|
||||
end
|
||||
|
||||
# Returns the mail adresses of users that should be notified
|
||||
def recipients
|
||||
notified = project.notified_users
|
||||
notified.reject! {|user| !visible?(user)}
|
||||
notified.collect(&:mail)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -90,13 +90,6 @@ class Message < ActiveRecord::Base
|
|||
usr && usr.logged? && (usr.allowed_to?(:delete_messages, project) || (self.author == usr && usr.allowed_to?(:delete_own_messages, project)))
|
||||
end
|
||||
|
||||
# Returns the mail adresses of users that should be notified
|
||||
def recipients
|
||||
notified = project.notified_users
|
||||
notified.reject! {|user| !visible?(user)}
|
||||
notified.collect(&:mail)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def add_author_as_watcher
|
||||
|
|
|
@ -33,13 +33,6 @@ class News < ActiveRecord::Base
|
|||
!user.nil? && user.allowed_to?(:view_news, project)
|
||||
end
|
||||
|
||||
# Returns the mail adresses of users that should be notified
|
||||
def recipients
|
||||
notified = project.notified_users
|
||||
notified.reject! {|user| !visible?(user)}
|
||||
notified.collect(&:mail)
|
||||
end
|
||||
|
||||
# returns latest news for projects visible by user
|
||||
def self.latest(user = User.current, count = 5)
|
||||
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
|
|||
(option.is_a?(Proc) ? option.call(self) : send(option)).merge(options)
|
||||
end
|
||||
|
||||
# Returns the mail adresses of users that should be notified
|
||||
def recipients
|
||||
notified = project.notified_users
|
||||
notified.reject! {|user| !visible?(user)}
|
||||
notified.collect(&:mail)
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue