From 2d47a6d71c0973598bf2d59c59bd4050e77f3861 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 27 Jan 2007 15:01:19 +0000 Subject: 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 --- app/models/mailer.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'app/models/mailer.rb') 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 -- cgit v1.2.3