Commit 6fa53d29 authored by Tim Zallmann's avatar Tim Zallmann

Merge branch 'bvl-refresh-member-listing-on-removal' into 'master'

Don't perform a JS request when deleting a membership.

Closes #39933 and #31720

See merge request gitlab-org/gitlab-ce!15344
parents 6ffb9ffd a591b1c3
......@@ -5,7 +5,6 @@ export default class Members {
}
addListeners() {
$('.project_member, .group_member').off('ajax:success').on('ajax:success', this.removeRow);
$('.js-member-update-control').off('change').on('change', this.formSubmit.bind(this));
$('.js-edit-member-form').off('ajax:success').on('ajax:success', this.formSuccess.bind(this));
gl.utils.disableButtonIfEmptyField('#user_ids', 'input[name=commit]', 'change');
......@@ -33,17 +32,6 @@ export default class Members {
});
});
}
// eslint-disable-next-line class-methods-use-this
removeRow(e) {
const $target = $(e.target);
if ($target.hasClass('btn-remove')) {
$target.closest('.member')
.fadeOut(function fadeOutMemberRow() {
$(this).remove();
});
}
}
formSubmit(e, $el = null) {
const $this = e ? $(e.currentTarget) : $el;
......
......@@ -104,7 +104,6 @@
class: 'btn btn-remove prepend-left-10'
- else
= link_to member,
remote: true,
method: :delete,
data: { confirm: remove_member_message(member) },
class: 'btn btn-remove prepend-left-10',
......
---
title: Don't use JS to delete memberships from projects and groups
merge_request: 15344
author:
type: fixed
......@@ -44,7 +44,11 @@ feature 'Groups > Members > Manage members' do
visit group_group_members_path(group)
accept_confirm do
find(:css, '.project-members-page li', text: user2.name).find(:css, 'a.btn-remove').click
end
wait_for_requests
expect(page).not_to have_content(user2.name)
expect(group.users).not_to include(user2)
......
......@@ -55,6 +55,22 @@ feature 'Project members list' do
end
end
scenario 'remove user from project', :js do
other_user = create(:user)
project.add_developer(other_user)
visit_members_page
accept_confirm do
find(:css, 'li.project_member', text: other_user.name).find(:css, 'a.btn-remove').click
end
wait_for_requests
expect(page).not_to have_content(other_user.name)
expect(project.users).not_to include(other_user)
end
scenario 'invite user to project', :js do
visit_members_page
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment