Project

General

Profile

Feature #36376 » 0001-Add-confirm-to-delete-link.patch

Mizuki ISHIKAWA, 2022-01-04 03:01

View differences:

app/views/projects/settings/_members.html.erb
31 31
                  :class => 'icon icon-edit' %>
32 32
      <%= delete_link membership_path(member),
33 33
                      :remote => true,
34
                      :data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {}) if member.deletable? %>
34
                      :data => {:confirm => (!User.current.admin? && member.include?(User.current) ? l(:text_own_membership_delete_confirmation) : l(:text_are_you_sure))} if member.deletable? %>
35 35
  </td>
36 36
  <%= call_hook(:view_projects_settings_members_table_row, { :project => @project, :member => member}) %>
37 37
  </tr>
test/functional/projects_controller_test.rb
907 907
    assert_select "tr#member-#{member.id}"
908 908
  end
909 909

  
910
  def test_settings_should_show_delete_link_with_confirmation_message
911
    @request.session[:user_id] = 2
912
    get(
913
      :settings,
914
      :params => {
915
        :id => 'ecookbook',
916
        :tab => 'members'
917
      }
918
    )
919
    assert_response :success
920

  
921
    # A link for the current user to remove own from the membership
922
    assert_select "tr#member-1 a.icon-del[data-confirm='#{l(:text_own_membership_delete_confirmation)}']"
923
    # A link to remove other user from the membership
924
    assert_select "tr#member-2 a.icon-del[data-confirm='#{l(:text_are_you_sure)}']"
925
  end
926

  
910 927
  def test_settings_should_show_tabs_depending_on_permission
911 928
    @request.session[:user_id] = 3
912 929
    project = Project.find(1)
(1-1/4)