Commit 7faaddca720caf4a109fc8455c03058374a3519a

Authored by Victor Costa
1 parent 2276f138
Exists in fix_sign_up_form

Fix task list in profile editor controller

app/controllers/my_profile/profile_editor_controller.rb
... ... @@ -12,7 +12,7 @@ class ProfileEditorController < MyProfileController
12 12 include CategoriesHelper
13 13  
14 14 def index
15   - @pending_tasks = Task.to(profile).pending.without_spam.select{|i| user.has_permission?(i.permission, profile)}
  15 + @pending_tasks = Task.to(profile).pending.without_spam
16 16 @show_appearance_option = user.is_admin?(environment) || environment.enabled?('enable_appearance')
17 17 @show_header_footer_option = user.is_admin?(environment) || (!profile.enterprise? && !environment.enabled?('disable_header_and_footer'))
18 18 end
... ...
test/functional/profile_editor_controller_test.rb
... ... @@ -391,8 +391,6 @@ class ProfileEditorControllerTest < ActionController::TestCase
391 391 user2 = create_user('usertwo').person
392 392 AddFriend.create!(:person => user1, :friend => user2)
393 393 @controller.stubs(:user).returns(user2)
394   - user2.stubs(:has_permission?).with('edit_profile', anything).returns(true)
395   - user2.expects(:has_permission?).with(:manage_friends, anything).returns(true)
396 394 login_as('usertwo')
397 395 get :index, :profile => 'usertwo'
398 396 assert_tag :tag => 'div', :attributes => { :class => 'pending-tasks' }
... ... @@ -400,11 +398,11 @@ class ProfileEditorControllerTest < ActionController::TestCase
400 398  
401 399 should 'not show task if user has no permission' do
402 400 user1 = profile
  401 + community = fast_create(Community)
403 402 user2 = create_user('usertwo').person
404   - task = AddFriend.create!(:person => user1, :friend => user2)
  403 + task = AddMember.create!(person: user1, organization: community)
405 404 @controller.stubs(:user).returns(user2)
406   - user2.stubs(:has_permission?).with('edit_profile', anything).returns(true)
407   - user2.expects(:has_permission?).with(:manage_friends, anything).returns(false)
  405 + give_permission(user2, 'invite_members', community)
408 406 login_as('usertwo')
409 407 get :index, :profile => 'usertwo'
410 408 assert_no_tag :tag => 'div', :attributes => { :class => 'pending-tasks' }
... ...