Files
Redmine/app/models/message_observer.rb
Nicolas Chuche d8549c5541 r18633@gaspard (orig r1875): jplang | 2008-09-17 21:18:31 +0200
reposman: change #log arguments.
 r18634@gaspard (orig r1876):  jplang | 2008-09-17 21:38:20 +0200
 Slight change on git repository creation command.
 r18635@gaspard (orig r1877):  jplang | 2008-09-17 21:47:36 +0200
 Make --command option usable on Windows.
 r18636@gaspard (orig r1878):  jplang | 2008-09-19 17:32:52 +0200
 Adds watch/unwatch functionality at forum topic level (#1912).
 Users who create/reply a topic are automatically added as watchers but are now able to unwatch the topic.
 r18637@gaspard (orig r1879):  winterheart | 2008-09-19 18:15:49 +0200
 update of ru.yml
 r18638@gaspard (orig r1880):  winterheart | 2008-09-19 18:17:35 +0200
 #1918, translation for zh-tw
 r18639@gaspard (orig r1881):  winterheart | 2008-09-19 18:20:45 +0200
 fixed #1920, patch for Hungarian language
 r18640@gaspard (orig r1882):  winterheart | 2008-09-19 18:23:04 +0200
 patch #1922, update for nl.yml
 r18641@gaspard (orig r1883):  winterheart | 2008-09-19 18:26:19 +0200
 #1923, updated zh.yml
 r18642@gaspard (orig r1884):  winterheart | 2008-09-19 18:30:39 +0200
 #1924, update for da.yml
 r18643@gaspard (orig r1885):  winterheart | 2008-09-19 18:33:08 +0200
 #1925, patch for lt.yml


git-svn-id: http://redmine.rubyforge.org/svn/branches/nbc@1886 e93f8b46-1217-0410-a6f0-8f06a7374b81
2008-09-19 20:14:13 +00:00

31 lines
1.4 KiB
Ruby

# redMine - project management software
# Copyright (C) 2006-2007 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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')
end
end