diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-01-27 15:01:19 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-01-27 15:01:19 +0000 |
commit | 2d47a6d71c0973598bf2d59c59bd4050e77f3861 (patch) | |
tree | d5e119cf6d5be90d667c90c4fc81cdd76ceb8543 /app/models/mailer.rb | |
parent | 22c2209cf9229e5f799a9612fadcb6119e412064 (diff) | |
download | redmine-2d47a6d71c0973598bf2d59c59bd4050e77f3861.tar.gz redmine-2d47a6d71c0973598bf2d59c59bd4050e77f3861.zip |
mail notifications added when:
* a document is added
* a file is added to the project
* an attachment is added to an issue or a document
git-svn-id: http://redmine.rubyforge.org/svn/trunk@196 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/mailer.rb')
-rw-r--r-- | app/models/mailer.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/app/models/mailer.rb b/app/models/mailer.rb index ba93b5bc7..0da6f967f 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -36,6 +36,36 @@ class Mailer < ActionMailer::Base @body['journal']= journal
end
+ def document_add(document)
+ @recipients = document.project.users.collect { |u| u.mail if u.mail_notification }.compact
+ @from = Setting.mail_from
+ @subject = "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}"
+ @body['document'] = document
+ end
+
+ def attachments_add(attachments)
+ container = attachments.first.container
+ url = "http://#{Setting.host_name}/"
+ added_to = ""
+ case container.class.to_s
+ when 'Version'
+ url << "projects/list_files/#{container.project_id}"
+ added_to = "#{l(:label_version)}: #{container.name}"
+ when 'Document'
+ url << "documents/show/#{container.id}"
+ added_to = "#{l(:label_document)}: #{container.title}"
+ when 'Issue'
+ url << "issues/show/#{container.id}"
+ added_to = "#{container.tracker.name} ##{container.id}: #{container.subject}"
+ end
+ @recipients = container.project.users.collect { |u| u.mail if u.mail_notification }.compact
+ @from = Setting.mail_from
+ @subject = "[#{container.project.name}] #{l(:label_attachment_new)}"
+ @body['attachments'] = attachments
+ @body['url'] = url
+ @body['added_to'] = added_to
+ end
+
def lost_password(token)
@recipients = token.user.mail
@from = Setting.mail_from
|