Commit 7faaddca720caf4a109fc8455c03058374a3519a
1 parent
2276f138
Exists in
fix_sign_up_form
Fix task list in profile editor controller
Showing
2 changed files
with
4 additions
and
6 deletions
Show diff stats
app/controllers/my_profile/profile_editor_controller.rb
@@ -12,7 +12,7 @@ class ProfileEditorController < MyProfileController | @@ -12,7 +12,7 @@ class ProfileEditorController < MyProfileController | ||
12 | include CategoriesHelper | 12 | include CategoriesHelper |
13 | 13 | ||
14 | def index | 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 | @show_appearance_option = user.is_admin?(environment) || environment.enabled?('enable_appearance') | 16 | @show_appearance_option = user.is_admin?(environment) || environment.enabled?('enable_appearance') |
17 | @show_header_footer_option = user.is_admin?(environment) || (!profile.enterprise? && !environment.enabled?('disable_header_and_footer')) | 17 | @show_header_footer_option = user.is_admin?(environment) || (!profile.enterprise? && !environment.enabled?('disable_header_and_footer')) |
18 | end | 18 | end |
test/functional/profile_editor_controller_test.rb
@@ -391,8 +391,6 @@ class ProfileEditorControllerTest < ActionController::TestCase | @@ -391,8 +391,6 @@ class ProfileEditorControllerTest < ActionController::TestCase | ||
391 | user2 = create_user('usertwo').person | 391 | user2 = create_user('usertwo').person |
392 | AddFriend.create!(:person => user1, :friend => user2) | 392 | AddFriend.create!(:person => user1, :friend => user2) |
393 | @controller.stubs(:user).returns(user2) | 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 | login_as('usertwo') | 394 | login_as('usertwo') |
397 | get :index, :profile => 'usertwo' | 395 | get :index, :profile => 'usertwo' |
398 | assert_tag :tag => 'div', :attributes => { :class => 'pending-tasks' } | 396 | assert_tag :tag => 'div', :attributes => { :class => 'pending-tasks' } |
@@ -400,11 +398,11 @@ class ProfileEditorControllerTest < ActionController::TestCase | @@ -400,11 +398,11 @@ class ProfileEditorControllerTest < ActionController::TestCase | ||
400 | 398 | ||
401 | should 'not show task if user has no permission' do | 399 | should 'not show task if user has no permission' do |
402 | user1 = profile | 400 | user1 = profile |
401 | + community = fast_create(Community) | ||
403 | user2 = create_user('usertwo').person | 402 | user2 = create_user('usertwo').person |
404 | - task = AddFriend.create!(:person => user1, :friend => user2) | 403 | + task = AddMember.create!(person: user1, organization: community) |
405 | @controller.stubs(:user).returns(user2) | 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 | login_as('usertwo') | 406 | login_as('usertwo') |
409 | get :index, :profile => 'usertwo' | 407 | get :index, :profile => 'usertwo' |
410 | assert_no_tag :tag => 'div', :attributes => { :class => 'pending-tasks' } | 408 | assert_no_tag :tag => 'div', :attributes => { :class => 'pending-tasks' } |