Commit 74f389412b601fa540bff1ad91106f37d6d13249
Committed by
Gabriel Silva
1 parent
44b7e940
Exists in
ratings_minor_fixes
and in
3 other branches
Adds reject explanation to add member task
Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com> Signed-off-by: Marcos Ronaldo <marcos.rpj2@gmail.com> Signed-off-by: Tallys Martins <tallysmartins@gmail.com> Signed-off-by: Thiago Ribeiro <thiagitosouza@gmail.com>
Showing
3 changed files
with
16 additions
and
3 deletions
Show diff stats
app/helpers/application_helper.rb
... | ... | @@ -981,6 +981,7 @@ module ApplicationHelper |
981 | 981 | values = {} |
982 | 982 | values.merge!(task.information[:variables]) if task.information[:variables] |
983 | 983 | values.merge!({:requestor => link_to(task.requestor.name, task.requestor.url)}) if task.requestor |
984 | + values.merge!({:target => link_to(task.target.name, task.target.url)}) if (task.target && task.target.respond_to?(:url)) | |
984 | 985 | values.merge!({:subject => content_tag('span', task.subject, :class=>'task_target')}) if task.subject |
985 | 986 | values.merge!({:linked_subject => link_to(content_tag('span', task.linked_subject[:text], :class => 'task_target'), task.linked_subject[:url])}) if task.linked_subject |
986 | 987 | (task.information[:message] % values).html_safe | ... | ... |
app/models/add_member.rb
... | ... | @@ -37,6 +37,10 @@ class AddMember < Task |
37 | 37 | true |
38 | 38 | end |
39 | 39 | |
40 | + def reject_details | |
41 | + true | |
42 | + end | |
43 | + | |
40 | 44 | def footer |
41 | 45 | true |
42 | 46 | end |
... | ... | @@ -72,8 +76,9 @@ class AddMember < Task |
72 | 76 | end |
73 | 77 | |
74 | 78 | def task_cancelled_message |
75 | - _("Your request to enter community \"%{target} with the profile \"%{requestor}\" was not accepted. Please contact any profile admin from %{url} for more information.") % | |
76 | - {:target => self.target.name, :url => self.target.url, | |
77 | - :requestor => self.requestor.name} | |
79 | + _("Your request to enter community \"%{target}\" with the profile \"%{requestor}\" was not accepted. Please contact any profile admin from %{target} for more information. The following explanation was given: \n\n\"%{explanation}\"") % | |
80 | + {:target => self.target.name, | |
81 | + :requestor => self.requestor.name, | |
82 | + :explanation => self.reject_explanation} | |
78 | 83 | end |
79 | 84 | end | ... | ... |
test/unit/add_member_test.rb
... | ... | @@ -149,4 +149,11 @@ class AddMemberTest < ActiveSupport::TestCase |
149 | 149 | |
150 | 150 | assert_no_match(/\(#{task.requestor.email}\)/, task.target_notification_description) |
151 | 151 | end |
152 | + | |
153 | + should 'have cancel notification message with explanation' do | |
154 | + explanation_message = 'some explanation' | |
155 | + task = AddMember.new(:person => person, :organization => community, | |
156 | + :reject_explanation => explanation_message) | |
157 | + assert_match(/#{explanation_message}/, task.task_cancelled_message) | |
158 | + end | |
152 | 159 | end | ... | ... |