diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e9b8340..410bb66 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -964,7 +964,7 @@ module ApplicationHelper content_tag(:div, _('Source: %s') % source_url, :id => 'article-source') unless source_url.nil? end - def task_information(task) + def task_information(task, params = {}) values = {} values.merge!(task.information[:variables]) if task.information[:variables] values.merge!({:requestor => link_to(task.requestor.name, task.requestor.url)}) if task.requestor diff --git a/app/views/profile_editor/_pending_tasks.html.erb b/app/views/profile_editor/_pending_tasks.html.erb index a7fc968..53e2246 100644 --- a/app/views/profile_editor/_pending_tasks.html.erb +++ b/app/views/profile_editor/_pending_tasks.html.erb @@ -4,7 +4,7 @@

<%= _('You have %s pending requests' % @pending_tasks.count) %>

<%= button(:todo, _('Process requests'), :controller => 'tasks', :action => 'index') %>
diff --git a/app/views/spam/_task.html.erb b/app/views/spam/_task.html.erb index 57cabe2..6952b75 100644 --- a/app/views/spam/_task.html.erb +++ b/app/views/spam/_task.html.erb @@ -2,7 +2,7 @@ <%= render :partial => 'tasks/task_icon', :locals => {:task => task} %> <%= render :partial => 'tasks/task_title', :locals => {:task => task} %>
- <%= task_information(task) %> + <%= task_information(task, params) %>
<%= yield %> <%# ??? %> diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb index d66be0c..1e16c60 100644 --- a/app/views/tasks/_task.html.erb +++ b/app/views/tasks/_task.html.erb @@ -47,7 +47,7 @@
- <%= task_information(task) %> + <%= task_information(task, params) %>
<%= fields_for "tasks[#{task.id}][task]", task do |f| %> diff --git a/app/views/tasks/_task_processed.html.erb b/app/views/tasks/_task_processed.html.erb index 7f35285..766b72b 100644 --- a/app/views/tasks/_task_processed.html.erb +++ b/app/views/tasks/_task_processed.html.erb @@ -1,5 +1,5 @@
- <%= task_information(task) %> + <%= task_information(task, params) %>
<%= _(Task::Status.names[task.status]) %> diff --git a/test/unit/application_helper_test.rb b/test/unit/application_helper_test.rb index 0403fcc..bf59155 100644 --- a/test/unit/application_helper_test.rb +++ b/test/unit/application_helper_test.rb @@ -973,10 +973,16 @@ class ApplicationHelperTest < ActionView::TestCase end should "show task information without target detail information on suggest article tasks if it's in the same profile" do - person = create_user('usertest').person - task = create(SuggestArticle, :target => person) - self.stubs(:params).returns({:profile => person.identifier}) - assert_no_match /in.*#{person.name}/, task_information(task) + profile = fast_create(Community) + task = create(SuggestArticle, :target => profile) + assert_no_match /in.*#{profile.name}/, task_information(task, {:profile => profile.identifier}) + end + + should "show task information with target detail information on suggest article with profile parameter to another profile" do + profile = fast_create(Community) + another_profile = fast_create(Community) + task = create(SuggestArticle, :target => profile) + assert_match /in.*#{profile.name}/, task_information(task, {:profile => another_profile.identifier}) end protected -- libgit2 0.21.2