summaryrefslogtreecommitdiffstats
path: root/app/models/mail_handler.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2009-03-28 00:38:57 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2009-03-28 00:38:57 +0000
commitb4be8849c0de81841c458c0f059787a9cc9bc022 (patch)
tree2db816db1cb3cf2fd0761f1e3ad0bc1373f9f12e /app/models/mail_handler.rb
parent3557e767e0b0c1e9fd7f97414a92f3d9dc00d98e (diff)
downloadredmine-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/mail_handler.rb')
-rw-r--r--app/models/mail_handler.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index 9b6410d57..023e1d63c 100644
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -110,13 +110,11 @@ class MailHandler < ActionMailer::Base
end
h
end
+ # add To and Cc as watchers before saving so the watchers can reply to Redmine
+ add_watchers(issue)
issue.save!
add_attachments(issue)
logger.info "MailHandler: issue ##{issue.id} created by #{user}" if logger && logger.info
- # add To and Cc as watchers
- add_watchers(issue)
- # send notification after adding watchers so that they can reply to Redmine
- Mailer.deliver_issue_add(issue) if Setting.notified_events.include?('issue_added')
issue
end
@@ -148,7 +146,6 @@ class MailHandler < ActionMailer::Base
end
issue.save!
logger.info "MailHandler: issue ##{issue.id} updated by #{user}" if logger && logger.info
- Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated')
journal
end