Commit f87e244bc7a2f13b9be7aa6107db71ed0ff36222
1 parent
1bfe3c11
Exists in
master
and in
29 other branches
ActionItem444: small things
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2026 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
4 changed files
with
26 additions
and
9 deletions
Show diff stats
app/models/task_mailer.rb
... | ... | @@ -14,7 +14,7 @@ class TaskMailer < ActionMailer::Base |
14 | 14 | |
15 | 15 | recipients task.target.contact_email |
16 | 16 | |
17 | - from task.requestor.environment.contact_email | |
17 | + from self.class.generate_from(task) | |
18 | 18 | subject task.description |
19 | 19 | body :requestor => task.requestor.name, |
20 | 20 | :target => task.target.name, |
... | ... | @@ -38,7 +38,7 @@ class TaskMailer < ActionMailer::Base |
38 | 38 | text = extract_message(message) |
39 | 39 | |
40 | 40 | recipients task.requestor.email |
41 | - from task.requestor.environment.contact_email | |
41 | + from self.class.generate_from(task) | |
42 | 42 | subject task.description |
43 | 43 | body :requestor => task.requestor.name, |
44 | 44 | :message => text, |
... | ... | @@ -46,4 +46,8 @@ class TaskMailer < ActionMailer::Base |
46 | 46 | :url => url_for(:host => task.requestor.environment.default_hostname, :controller => 'home') |
47 | 47 | end |
48 | 48 | |
49 | + def self.generate_from(task) | |
50 | + "#{task.requestor.environment.name} <#{task.requestor.environment.contact_email}>" | |
51 | + end | |
52 | + | |
49 | 53 | end | ... | ... |
app/views/account/new_password.rhtml
1 | 1 | <h1><%= _('Enter new password') %></h1> |
2 | 2 | |
3 | 3 | <p> |
4 | -<%= _("Hello, %s! Please enter your new password in the form below.") % @change_password.requestor.identifier %> | |
4 | +<%= _("Hello, %s! Please enter your new password in the form below.") % @change_password.requestor.name %> | |
5 | 5 | </p> |
6 | 6 | |
7 | 7 | <%= error_messages_for :change_password %> | ... | ... |
po/pt_BR/noosfero.po
... | ... | @@ -10,7 +10,7 @@ msgid "" |
10 | 10 | msgstr "" |
11 | 11 | "Project-Id-Version: noosfero 0.10.0\n" |
12 | 12 | "POT-Creation-Date: 2008-06-11 14:42-0300\n" |
13 | -"PO-Revision-Date: 2008-06-13 16:35-0300\n" | |
13 | +"PO-Revision-Date: 2008-06-13 17:52-0300\n" | |
14 | 14 | "Last-Translator: Joenio Costa <joenio@colivre.coop.br>\n" |
15 | 15 | "Language-Team: \n" |
16 | 16 | "MIME-Version: 1.0\n" |
... | ... | @@ -1949,7 +1949,7 @@ msgstr "Não, eu quero ficar." |
1949 | 1949 | #: app/views/account/new_password.rhtml:1 |
1950 | 1950 | #: app/views/account/new_password.rhtml:11 |
1951 | 1951 | msgid "Enter new password" |
1952 | -msgstr "Enter com a nova senha" | |
1952 | +msgstr "Entre com a nova senha" | |
1953 | 1953 | |
1954 | 1954 | #: app/views/account/new_password.rhtml:4 |
1955 | 1955 | msgid "Hello, %s! Please enter your new password in the form below." | ... | ... |
test/unit/task_mailer_test.rb
... | ... | @@ -29,7 +29,7 @@ class TaskMailerTest < Test::Unit::TestCase |
29 | 29 | environment = mock() |
30 | 30 | environment.expects(:contact_email).returns('sender@example.com') |
31 | 31 | environment.expects(:default_hostname).returns('example.com') |
32 | - environment.expects(:name).returns('example') | |
32 | + environment.expects(:name).returns('example').at_least_once | |
33 | 33 | |
34 | 34 | task.expects(:requestor).returns(requestor).at_least_once |
35 | 35 | requestor.expects(:environment).returns(environment).at_least_once |
... | ... | @@ -50,7 +50,7 @@ class TaskMailerTest < Test::Unit::TestCase |
50 | 50 | environment = mock() |
51 | 51 | environment.expects(:contact_email).returns('sender@example.com') |
52 | 52 | environment.expects(:default_hostname).returns('example.com') |
53 | - environment.expects(:name).returns('example') | |
53 | + environment.expects(:name).returns('example').at_least_once | |
54 | 54 | |
55 | 55 | task.expects(:requestor).returns(requestor).at_least_once |
56 | 56 | requestor.expects(:environment).returns(environment).at_least_once |
... | ... | @@ -72,7 +72,7 @@ class TaskMailerTest < Test::Unit::TestCase |
72 | 72 | environment = mock() |
73 | 73 | environment.expects(:contact_email).returns('sender@example.com') |
74 | 74 | environment.expects(:default_hostname).returns('example.com') |
75 | - environment.expects(:name).returns('example') | |
75 | + environment.expects(:name).returns('example').at_least_once | |
76 | 76 | |
77 | 77 | task.expects(:requestor).returns(requestor).at_least_once |
78 | 78 | requestor.expects(:environment).returns(environment).at_least_once |
... | ... | @@ -94,7 +94,7 @@ class TaskMailerTest < Test::Unit::TestCase |
94 | 94 | environment = mock() |
95 | 95 | environment.expects(:contact_email).returns('sender@example.com') |
96 | 96 | environment.expects(:default_hostname).returns('example.com') |
97 | - environment.expects(:name).returns('example') | |
97 | + environment.expects(:name).returns('example').at_least_once | |
98 | 98 | |
99 | 99 | task.expects(:requestor).returns(requestor).at_least_once |
100 | 100 | task.expects(:target).returns(target).at_least_once |
... | ... | @@ -103,6 +103,19 @@ class TaskMailerTest < Test::Unit::TestCase |
103 | 103 | TaskMailer.deliver_target_notification(task, 'the message') |
104 | 104 | end |
105 | 105 | |
106 | + should 'use environment name and contact email' do | |
107 | + task = mock | |
108 | + requestor = mock | |
109 | + environment = mock | |
110 | + environment.expects(:name).returns('My name') | |
111 | + environment.expects(:contact_email).returns('email@example.com') | |
112 | + | |
113 | + task.expects(:requestor).returns(requestor).at_least_once | |
114 | + requestor.expects(:environment).returns(environment).at_least_once | |
115 | + | |
116 | + assert_equal 'My name <email@example.com>', TaskMailer.generate_from(task) | |
117 | + end | |
118 | + | |
106 | 119 | |
107 | 120 | private |
108 | 121 | def read_fixture(action) | ... | ... |