Commit dbd7cf092e1df446f40bcbdd3fad6280431130e3

Authored by dtygel
Committed by Braulio Bhavamitra
1 parent fea4d5ef

Better phrase for new member request

app/models/add_member.rb
@@ -26,7 +26,8 @@ class AddMember < Task @@ -26,7 +26,8 @@ class AddMember < Task
26 end 26 end
27 27
28 def information 28 def information
29 - {:message => _('%{requestor} wants to be a member of this community.')} 29 + {:message => _("%{requestor} wants to be a member of '%{organization}'."),
  30 + variables: {requestor: requestor.name, organization: organization.name}}
30 end 31 end
31 32
32 def accept_details 33 def accept_details
@@ -42,7 +43,7 @@ class AddMember < Task @@ -42,7 +43,7 @@ class AddMember < Task
42 end 43 end
43 44
44 def target_notification_description 45 def target_notification_description
45 - _('%{requestor} wants to be a member of this community.') % {:requestor => requestor.name} 46 + _("%{requestor} wants to be a member of '%{organization}'.") % {:requestor => requestor.name, :organization => organization.name}
46 end 47 end
47 48
48 def target_notification_message 49 def target_notification_message
test/unit/add_member_test.rb
@@ -105,20 +105,20 @@ class AddMemberTest < ActiveSupport::TestCase @@ -105,20 +105,20 @@ class AddMemberTest < ActiveSupport::TestCase
105 should 'have target notification message' do 105 should 'have target notification message' do
106 task = AddMember.new(:person => person, :organization => community) 106 task = AddMember.new(:person => person, :organization => community)
107 107
108 - assert_match(/#{person.name} wants to be a member of this community.*[\n]*.*to accept or reject/, task.target_notification_message) 108 + assert_match(/#{person.name} wants to be a member of '#{community.name}'.*[\n]*.*to accept or reject/, task.target_notification_message)
109 end 109 end
110 110
111 should 'have target notification description' do 111 should 'have target notification description' do
112 task = AddMember.new(:person => person, :organization => community) 112 task = AddMember.new(:person => person, :organization => community)
113 113
114 - assert_match(/#{task.requestor.name} wants to be a member of this community/, task.target_notification_description) 114 + assert_match(/#{task.requestor.name} wants to be a member of '#{community.name}'/, task.target_notification_description)
115 end 115 end
116 116
117 should 'deliver target notification message' do 117 should 'deliver target notification message' do
118 task = AddMember.new(:person => person, :organization => community) 118 task = AddMember.new(:person => person, :organization => community)
119 119
120 email = TaskMailer.target_notification(task, task.target_notification_message).deliver 120 email = TaskMailer.target_notification(task, task.target_notification_message).deliver
121 - assert_match(/#{task.requestor.name} wants to be a member of this community/, email.subject) 121 + assert_match(/#{task.requestor.name} wants to be a member of '#{community.name}'/, email.subject)
122 end 122 end
123 123
124 end 124 end