Make sure users don't get notified for thing they can not view (#3589).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3169 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2009-12-13 14:26:54 +00:00
parent 6610bb6b6c
commit bb477a3a0f
7 changed files with 97 additions and 22 deletions
+1 -9
View File
@@ -17,14 +17,6 @@
class MessageObserver < ActiveRecord::Observer
def after_create(message)
recipients = []
# send notification to the topic watchers
recipients += message.root.watcher_recipients
# send notification to the board watchers
recipients += message.board.watcher_recipients
# send notification to project members who want to be notified
recipients += message.board.project.recipients
recipients = recipients.compact.uniq
Mailer.deliver_message_posted(message, recipients) if !recipients.empty? && Setting.notified_events.include?('message_posted')
Mailer.deliver_message_posted(message) if Setting.notified_events.include?('message_posted')
end
end