summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-02-01 18:57:12 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-02-01 18:57:12 +0000
commit358e3194d79b9e4503edd48d2179b9f8f2920cd3 (patch)
treeb756b0e53207d924b805398028bae104da2b1019
parentd43c860448ce71ca3f35ac6487775deaa0dcb3c3 (diff)
downloadredmine-358e3194d79b9e4503edd48d2179b9f8f2920cd3.tar.gz
redmine-358e3194d79b9e4503edd48d2179b9f8f2920cd3.zip
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
-rw-r--r--app/models/document.rb7
-rw-r--r--app/models/message.rb7
-rw-r--r--app/models/news.rb7
-rw-r--r--vendor/plugins/acts_as_event/lib/acts_as_event.rb7
4 files changed, 7 insertions, 21 deletions
diff --git a/app/models/document.rb b/app/models/document.rb
index d2d20d05d..3aae39850 100644
--- a/app/models/document.rb
+++ b/app/models/document.rb
@@ -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
diff --git a/app/models/message.rb b/app/models/message.rb
index 535143775..1e59719dd 100644
--- a/app/models/message.rb
+++ b/app/models/message.rb
@@ -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
diff --git a/app/models/news.rb b/app/models/news.rb
index a7b173439..a167cdf38 100644
--- a/app/models/news.rb
+++ b/app/models/news.rb
@@ -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")
diff --git a/vendor/plugins/acts_as_event/lib/acts_as_event.rb b/vendor/plugins/acts_as_event/lib/acts_as_event.rb
index 0b7ad21f5..1aa7ddf01 100644
--- a/vendor/plugins/acts_as_event/lib/acts_as_event.rb
+++ b/vendor/plugins/acts_as_event/lib/acts_as_event.rb
@@ -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