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