diff --git a/app/views/profile_editor/_pending_tasks.html.erb b/app/views/profile_editor/_pending_tasks.html.erb
index cd3ed15..a7fc968 100644
--- a/app/views/profile_editor/_pending_tasks.html.erb
+++ b/app/views/profile_editor/_pending_tasks.html.erb
@@ -2,9 +2,9 @@
<% unless @pending_tasks.empty? %>
-
<%= _('You have pending requests') %>
+
<%= _('You have %s pending requests' % @pending_tasks.count) %>
- <%= safe_join(@pending_tasks.map {|task| content_tag('li', task_information(task).html_safe)}) %>
+ <%= safe_join(@pending_tasks.limit(5).map {|task| content_tag('li', task_information(task).html_safe)}) %>
<%= button(:todo, _('Process requests'), :controller => 'tasks', :action => 'index') %>
diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb
index ae7cd54..000d132 100644
--- a/test/functional/profile_editor_controller_test.rb
+++ b/test/functional/profile_editor_controller_test.rb
@@ -408,6 +408,24 @@ class ProfileEditorControllerTest < ActionController::TestCase
assert_no_tag :tag => 'div', :attributes => { :class => 'pending-tasks' }
end
+ should 'limit task list' do
+ user2 = create_user('usertwo').person
+ 6.times { AddFriend.create!(:person => create_user.person, :friend => user2) }
+ login_as('usertwo')
+ get :index, :profile => 'usertwo'
+ assert_select '.pending-tasks > ul > li', 5
+ end
+
+ should 'display task count in task list' do
+ user2 = create_user('usertwo').person
+ 6.times { AddFriend.create!(:person => create_user.person, :friend => user2) }
+ login_as('usertwo')
+ get :index, :profile => 'usertwo'
+ assert_select '.pending-tasks h2' do |elements|
+ assert_match /6/, elements.first.content
+ end
+ end
+
should 'show favorite enterprises button for person' do
get :index, :profile => profile.identifier
assert_tag :tag => 'a', :content => 'Favorite Enterprises'
--
libgit2 0.21.2