diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2009-03-28 00:38:57 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2009-03-28 00:38:57 +0000 |
commit | b4be8849c0de81841c458c0f059787a9cc9bc022 (patch) | |
tree | 2db816db1cb3cf2fd0761f1e3ad0bc1373f9f12e /app/models/document_observer.rb | |
parent | 3557e767e0b0c1e9fd7f97414a92f3d9dc00d98e (diff) | |
download | redmine-b4be8849c0de81841c458c0f059787a9cc9bc022.tar.gz redmine-b4be8849c0de81841c458c0f059787a9cc9bc022.zip |
Added observers to watch model objects for mail delivery instead of calling Mailer.
* Added an IssueObserver to watch when Issues are created
* Added a JournalObserver to watch when Journals are created (Issue updates)
* Added a NewsObserver for News items.
* Added a DocumentObserver for Document notifications.
* Setup IssuesController#new to use the IssueObserver.
* Setup IssuesController#edit to use the IssueObserver.
* Setup IssuesController#bulk_edit to use the JournalObserver.
* Removed the Mailer call in Changeset#scan_commit_for_issue_ids, the
JournalObserver will handle it.
* Removed Mailer calls in MailHandler in favor of the Observers.
#2659
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2637 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/document_observer.rb')
-rw-r--r-- | app/models/document_observer.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/models/document_observer.rb b/app/models/document_observer.rb new file mode 100644 index 000000000..3125c97b3 --- /dev/null +++ b/app/models/document_observer.rb @@ -0,0 +1,22 @@ +# 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 DocumentObserver < ActiveRecord::Observer + def after_create(document) + Mailer.deliver_document_added(document) if Setting.notified_events.include?('document_added') + end +end |