summaryrefslogtreecommitdiffstats
path: root/app/models/message_observer.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-08-12 10:16:30 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-08-12 10:16:30 +0000
commitc4fee1196961665cd1aeeb12f53c0c2b58bba616 (patch)
tree0b478aa3082120a78ffe2e7fd73da53cfa892237 /app/models/message_observer.rb
parent5bd26ede420090c7cb3744518a2fc0f1547f94cb (diff)
downloadredmine-c4fee1196961665cd1aeeb12f53c0c2b58bba616.tar.gz
redmine-c4fee1196961665cd1aeeb12f53c0c2b58bba616.zip
Forum notifications are now also sent to the authors of the thread, even if they don't watch the board.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@607 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/message_observer.rb')
-rw-r--r--app/models/message_observer.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/models/message_observer.rb b/app/models/message_observer.rb
index a3db7c867..cdf7b6ef6 100644
--- a/app/models/message_observer.rb
+++ b/app/models/message_observer.rb
@@ -17,8 +17,11 @@
class MessageObserver < ActiveRecord::Observer
def after_create(message)
- # send notification to board watchers
- recipients = message.board.watcher_recipients
+ # send notification to the authors of the thread
+ recipients = ([message.root] + message.root.children).collect {|m| m.author.mail if m.author}
+ # send notification to the board watchers
+ recipients += message.board.watcher_recipients
+ recipients = recipients.compact.uniq
Mailer.deliver_message_posted(message, recipients) unless recipients.empty?
end
end