Commit 6979130dc3e1a37d7da89928a76be0fbd9470163

Authored by Antonio Terceiro
1 parent 1bea16bd

Better wording in notification e-mails

(ActionItem1610)
app/views/contact/sender/mail.rhtml
@@ -5,10 +5,12 @@ @@ -5,10 +5,12 @@
5 <% end %> 5 <% end %>
6 6
7 <%= _('Message:') %> 7 <%= _('Message:') %>
8 --- 8 +-------------------------------------------------------------------------------
  9 +<%= word_wrap(@message) %>
  10 +-------------------------------------------------------------------------------
9 11
10 -<%= @message %> 12 +<%= _('Greetings,') %>
11 13
12 -- 14 --
13 -<%= _('%s environment system') % @environment %> 15 +<%= _('%s team.') % @environment %>
14 <%= @url %> 16 <%= @url %>
app/views/pending_task_notifier/notification.rhtml
@@ -17,6 +17,9 @@ @@ -17,6 +17,9 @@
17 17
18 <%= url_for(:host => @default_hostname, :controller => 'tasks', :profile => organization.identifier) %> 18 <%= url_for(:host => @default_hostname, :controller => 'tasks', :profile => organization.identifier) %>
19 <% end %> 19 <% end %>
  20 +
  21 +<%= _('Greetings,') %>
  22 +
20 -- 23 --
21 -<%= _('%s environment system') % @environment %> 24 +<%= _('%s team.') % @environment %>
22 <%= @url %> 25 <%= @url %>
app/views/task_mailer/task_cancelled.text.plain.rhtml
1 <%= _('Dear %s,') % @requestor %> 1 <%= _('Dear %s,') % @requestor %>
2 2
3 -<%= @message %> 3 +<%= word_wrap(@message) %>
  4 +
  5 +<%= _('Greetings,') %>
4 6
5 -- 7 --
6 -<%= _('%s environment system') % @environment %> 8 +<%= _('%s team.') % @environment %>
7 <%= @url %> 9 <%= @url %>
app/views/user/mailer/activation_email_notify.rhtml
@@ -5,6 +5,8 @@ @@ -5,6 +5,8 @@
5 <%= _('You can access your e-mail from anywhere, using the following address:') %> 5 <%= _('You can access your e-mail from anywhere, using the following address:') %>
6 <%= @webmail %> 6 <%= @webmail %>
7 7
  8 +<%= _('Greetings,') %>
  9 +
8 -- 10 --
9 -<%= _('%s environment system') % @environment %> 11 +<%= _('%s team.') % @environment %>
10 <%= @url %> 12 <%= @url %>
test/factories.rb
@@ -338,4 +338,12 @@ module Noosfero::Factory @@ -338,4 +338,12 @@ module Noosfero::Factory
338 { } 338 { }
339 end 339 end
340 340
  341 + ###############################################
  342 + # Contact
  343 + ###############################################
  344 +
  345 + def defaults_for_contact
  346 + { :subject => 'hello there', :message => 'here I come to SPAM you' }
  347 + end
  348 +
341 end 349 end
test/unit/contact_sender_test.rb
@@ -14,7 +14,7 @@ class ContactSenderTest &lt; Test::Unit::TestCase @@ -14,7 +14,7 @@ class ContactSenderTest &lt; Test::Unit::TestCase
14 should 'be able to deliver mail' do 14 should 'be able to deliver mail' do
15 ent = Enterprise.new(:name => 'my enterprise', :identifier => 'myent', :environment => Environment.default) 15 ent = Enterprise.new(:name => 'my enterprise', :identifier => 'myent', :environment => Environment.default)
16 ent.contact_email = 'contact@invalid.com' 16 ent.contact_email = 'contact@invalid.com'
17 - c = Contact.new(:dest => ent, :subject => 'hi molly') 17 + c = build(Contact, :dest => ent)
18 response = Contact::Sender.deliver_mail(c) 18 response = Contact::Sender.deliver_mail(c)
19 assert_equal c.email, response.from 19 assert_equal c.email, response.from
20 assert_equal c.subject, response.subject 20 assert_equal c.subject, response.subject
@@ -23,7 +23,7 @@ class ContactSenderTest &lt; Test::Unit::TestCase @@ -23,7 +23,7 @@ class ContactSenderTest &lt; Test::Unit::TestCase
23 should 'deliver mail to contact_email' do 23 should 'deliver mail to contact_email' do
24 ent = Enterprise.new(:name => 'my enterprise', :identifier => 'myent', :environment => Environment.default) 24 ent = Enterprise.new(:name => 'my enterprise', :identifier => 'myent', :environment => Environment.default)
25 ent.contact_email = 'contact@invalid.com' 25 ent.contact_email = 'contact@invalid.com'
26 - c = Contact.new(:dest => ent) 26 + c = build(Contact, :dest => ent)
27 response = Contact::Sender.deliver_mail(c) 27 response = Contact::Sender.deliver_mail(c)
28 assert_includes response.to, c.dest.contact_email 28 assert_includes response.to, c.dest.contact_email
29 end 29 end
@@ -34,28 +34,28 @@ class ContactSenderTest &lt; Test::Unit::TestCase @@ -34,28 +34,28 @@ class ContactSenderTest &lt; Test::Unit::TestCase
34 ent.contact_email = 'contact@invalid.com' 34 ent.contact_email = 'contact@invalid.com'
35 ent.add_admin(admin) 35 ent.add_admin(admin)
36 assert ent.save! 36 assert ent.save!
37 - c = Contact.new(:dest => ent) 37 + c = build(Contact, :dest => ent)
38 response = Contact::Sender.deliver_mail(c) 38 response = Contact::Sender.deliver_mail(c)
39 assert_includes response.to, admin.email 39 assert_includes response.to, admin.email
40 end 40 end
41 41
42 should 'deliver a copy of email if requester wants' do 42 should 'deliver a copy of email if requester wants' do
43 ent = Enterprise.new(:name => 'my enterprise', :identifier => 'myent', :environment => Environment.default) 43 ent = Enterprise.new(:name => 'my enterprise', :identifier => 'myent', :environment => Environment.default)
44 - c = Contact.new(:dest => ent, :email => 'requester@invalid.com', :receive_a_copy => true) 44 + c = build(Contact, :dest => ent, :email => 'requester@invalid.com', :receive_a_copy => true)
45 response = Contact::Sender.deliver_mail(c) 45 response = Contact::Sender.deliver_mail(c)
46 assert_includes response.cc, c.email 46 assert_includes response.cc, c.email
47 end 47 end
48 48
49 should 'not deliver a copy of email if requester dont wants' do 49 should 'not deliver a copy of email if requester dont wants' do
50 ent = Enterprise.new(:name => 'my enterprise', :identifier => 'myent', :environment => Environment.default) 50 ent = Enterprise.new(:name => 'my enterprise', :identifier => 'myent', :environment => Environment.default)
51 - c = Contact.new(:dest => ent, :email => 'requester@invalid.com', :receive_a_copy => false) 51 + c = build(Contact, :dest => ent, :email => 'requester@invalid.com', :receive_a_copy => false)
52 response = Contact::Sender.deliver_mail(c) 52 response = Contact::Sender.deliver_mail(c)
53 assert_nil response.cc 53 assert_nil response.cc
54 end 54 end
55 55
56 should 'only deliver mail to email of person' do 56 should 'only deliver mail to email of person' do
57 person = create_user('contacted_user').person 57 person = create_user('contacted_user').person
58 - c = Contact.new(:dest => person) 58 + c = build(Contact, :dest => person)
59 response = Contact::Sender.deliver_mail(c) 59 response = Contact::Sender.deliver_mail(c)
60 assert_equal [person.email], response.to 60 assert_equal [person.email], response.to
61 end 61 end
@@ -63,7 +63,7 @@ class ContactSenderTest &lt; Test::Unit::TestCase @@ -63,7 +63,7 @@ class ContactSenderTest &lt; Test::Unit::TestCase
63 should 'identify the sender in the message headers' do 63 should 'identify the sender in the message headers' do
64 recipient = create_user('contacted_user').person 64 recipient = create_user('contacted_user').person
65 sender = create_user('sender_user').person 65 sender = create_user('sender_user').person
66 - c = Contact.new(:dest => recipient, :sender => sender) 66 + c = build(Contact, :dest => recipient, :sender => sender)
67 sent_message = Contact::Sender.deliver_mail(c) 67 sent_message = Contact::Sender.deliver_mail(c)
68 assert_equal 'sender_user', sent_message['X-Noosfero-Sender'].to_s 68 assert_equal 'sender_user', sent_message['X-Noosfero-Sender'].to_s
69 end 69 end