##// END OF EJS Templates
Fixed: no email notification on new project/version file added (#4966)....
Jean-Philippe Lang -
r3418:cdb86d5ef7d2
parent child
Show More
@@ -114,11 +114,11 class Mailer < ActionMailer::Base
114 when 'Project'
114 when 'Project'
115 added_to_url = url_for(:controller => 'projects', :action => 'list_files', :id => container)
115 added_to_url = url_for(:controller => 'projects', :action => 'list_files', :id => container)
116 added_to = "#{l(:label_project)}: #{container}"
116 added_to = "#{l(:label_project)}: #{container}"
117 recipients container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}
117 recipients container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}.collect {|u| u.mail}
118 when 'Version'
118 when 'Version'
119 added_to_url = url_for(:controller => 'projects', :action => 'list_files', :id => container.project_id)
119 added_to_url = url_for(:controller => 'projects', :action => 'list_files', :id => container.project_id)
120 added_to = "#{l(:label_version)}: #{container.name}"
120 added_to = "#{l(:label_version)}: #{container.name}"
121 recipients container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}
121 recipients container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}.collect {|u| u.mail}
122 when 'Document'
122 when 'Document'
123 added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
123 added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
124 added_to = "#{l(:label_document)}: #{container.title}"
124 added_to = "#{l(:label_document)}: #{container.title}"
@@ -273,6 +273,20 class MailerTest < ActiveSupport::TestCase
273 end
273 end
274 end
274 end
275
275
276 def test_version_file_added
277 attachements = [ Attachment.find_by_container_type('Version') ]
278 assert Mailer.deliver_attachments_added(attachements)
279 assert_not_nil last_email.bcc
280 assert last_email.bcc.any?
281 end
282
283 def test_project_file_added
284 attachements = [ Attachment.find_by_container_type('Project') ]
285 assert Mailer.deliver_attachments_added(attachements)
286 assert_not_nil last_email.bcc
287 assert last_email.bcc.any?
288 end
289
276 def test_news_added
290 def test_news_added
277 news = News.find(:first)
291 news = News.find(:first)
278 valid_languages.each do |lang|
292 valid_languages.each do |lang|
General Comments 0
You need to be logged in to leave comments. Login now