Commit 315ed27e4c783ea9ae2fc76dc3e117f67e863593
Exists in
ratings_minor_fixes
and in
3 other branches
Merge branch 'add_member_task_reject_details' into 'master'
AddMemberTask explanation message Adds explanation field to reject details in add member task See merge request !921
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,6 +981,7 @@ module ApplicationHelper | ||
| 981 | values = {} | 981 | values = {} |
| 982 | values.merge!(task.information[:variables]) if task.information[:variables] | 982 | values.merge!(task.information[:variables]) if task.information[:variables] |
| 983 | values.merge!({:requestor => link_to(task.requestor.name, task.requestor.url)}) if task.requestor | 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 | values.merge!({:subject => content_tag('span', task.subject, :class=>'task_target')}) if task.subject | 985 | values.merge!({:subject => content_tag('span', task.subject, :class=>'task_target')}) if task.subject |
| 985 | 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 | 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 | (task.information[:message] % values).html_safe | 987 | (task.information[:message] % values).html_safe |
app/models/add_member.rb
| @@ -37,6 +37,10 @@ class AddMember < Task | @@ -37,6 +37,10 @@ class AddMember < Task | ||
| 37 | true | 37 | true |
| 38 | end | 38 | end |
| 39 | 39 | ||
| 40 | + def reject_details | ||
| 41 | + true | ||
| 42 | + end | ||
| 43 | + | ||
| 40 | def footer | 44 | def footer |
| 41 | true | 45 | true |
| 42 | end | 46 | end |
| @@ -72,8 +76,9 @@ class AddMember < Task | @@ -72,8 +76,9 @@ class AddMember < Task | ||
| 72 | end | 76 | end |
| 73 | 77 | ||
| 74 | def task_cancelled_message | 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 | end | 83 | end |
| 79 | end | 84 | end |
test/unit/add_member_test.rb
| @@ -149,4 +149,11 @@ class AddMemberTest < ActiveSupport::TestCase | @@ -149,4 +149,11 @@ class AddMemberTest < ActiveSupport::TestCase | ||
| 149 | 149 | ||
| 150 | assert_no_match(/\(#{task.requestor.email}\)/, task.target_notification_description) | 150 | assert_no_match(/\(#{task.requestor.email}\)/, task.target_notification_description) |
| 151 | end | 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 | end | 159 | end |