Commit 97dced24 authored by Brandon Labuschagne's avatar Brandon Labuschagne

Merge branch '327369-update-controls-in-admin-projects-or-groups-access-requests-2' into 'master'

Remove access request controls in admin area and replace with "Manage access" button

See merge request gitlab-org/gitlab!64659
parents 82fa4f9a b7faa327
...@@ -128,10 +128,7 @@ ...@@ -128,10 +128,7 @@
.card-header .card-header
= html_escape(_("%{group_name} group members")) % { group_name: "<strong>#{html_escape(@group.name)}</strong>".html_safe } = html_escape(_("%{group_name} group members")) % { group_name: "<strong>#{html_escape(@group.name)}</strong>".html_safe }
%span.badge.badge-pill= @group.users_count %span.badge.badge-pill= @group.users_count
.float-right = render 'shared/members/manage_access_button', path: group_group_members_path(@group)
= link_to group_group_members_path(@group), class: 'btn btn-default gl-button btn-sm' do
= sprite_icon('pencil-square', css_class: 'gl-icon')
= _('Manage access')
%ul.content-list.group-users-list.content-list.members-list %ul.content-list.group-users-list.content-list.members-list
= render partial: 'shared/members/member', = render partial: 'shared/members/member',
collection: @members, as: :member, collection: @members, as: :member,
......
...@@ -180,10 +180,7 @@ ...@@ -180,10 +180,7 @@
%strong= @group.name %strong= @group.name
= _('group members') = _('group members')
%span.badge.badge-pill= @group_members.size %span.badge.badge-pill= @group_members.size
.float-right = render 'shared/members/manage_access_button', path: group_group_members_path(@group)
= link_to admin_group_path(@group), class: 'btn btn-default gl-button btn-sm' do
= sprite_icon('pencil-square', css_class: 'gl-icon')
= _('Manage access')
%ul.content-list.members-list %ul.content-list.members-list
= render partial: 'shared/members/member', = render partial: 'shared/members/member',
collection: @group_members, as: :member, collection: @group_members, as: :member,
...@@ -194,17 +191,14 @@ ...@@ -194,17 +191,14 @@
.card-footer .card-footer
= paginate @group_members, param_name: 'group_members_page', theme: 'gitlab' = paginate @group_members, param_name: 'group_members_page', theme: 'gitlab'
= render 'shared/members/requests', membership_source: @project, group: @group, requesters: @requesters, force_mobile_view: true = render 'shared/members/requests', membership_source: @project, group: @group, requesters: @requesters
.card .card
.card-header .card-header
%strong= @project.name %strong= @project.name
= _('project members') = _('project members')
%span.badge.badge-pill= @project.users.size %span.badge.badge-pill= @project.users.size
.float-right = render 'shared/members/manage_access_button', path: project_project_members_path(@project)
= link_to project_project_members_path(@project), class: 'btn btn-default gl-button btn-sm' do
= sprite_icon('pencil-square', css_class: 'gl-icon')
= _('Manage access')
%ul.content-list.project_members.members-list %ul.content-list.project_members.members-list
= render partial: 'shared/members/member', = render partial: 'shared/members/member',
collection: @project_members, as: :member, collection: @project_members, as: :member,
......
- path = local_assigns.fetch(:path, nil)
.gl-float-right
= link_to path, class: 'btn btn-default btn-sm gl-button' do
= sprite_icon('pencil-square', css_class: 'gl-icon gl-button-icon')
%span.gl-button-text
= _('Manage access')
- membership_source = local_assigns.fetch(:membership_source) - membership_source = local_assigns.fetch(:membership_source)
- requesters = local_assigns.fetch(:requesters) - requesters = local_assigns.fetch(:requesters)
- force_mobile_view = local_assigns.fetch(:force_mobile_view, false)
- group = local_assigns.fetch(:group) - group = local_assigns.fetch(:group)
- current_user_is_group_owner = group && group.has_owner?(current_user) - current_user_is_group_owner = group && group.has_owner?(current_user)
- return if requesters.empty? - return if requesters.empty?
.card.gl-mt-3{ class: ('card-mobile' if force_mobile_view ) } .card.gl-mt-3{ data: { testid: 'access-requests' } }
.card-header .card-header
= _("Users requesting access to") = _("Users requesting access to")
%strong= membership_source.name %strong= membership_source.name
%span.badge.badge-pill= requesters.size %span.badge.badge-pill= requesters.size
= render 'shared/members/manage_access_button', path: membership_source.is_a?(Project) ? project_project_members_path(@project, tab: 'access_requests') : group_group_members_path(@group, tab: 'access_requests')
%ul.content-list.members-list %ul.content-list.members-list
= render partial: 'shared/members/member', = render partial: 'shared/members/member',
collection: requesters, as: :member, collection: requesters, as: :member,
locals: { membership_source: membership_source, locals: { membership_source: membership_source,
group: group, group: group,
force_mobile_view: force_mobile_view, show_controls: false,
current_user_is_group_owner: current_user_is_group_owner } current_user_is_group_owner: current_user_is_group_owner }
...@@ -132,6 +132,19 @@ RSpec.describe 'Admin Groups' do ...@@ -132,6 +132,19 @@ RSpec.describe 'Admin Groups' do
expect(page).to have_text(note_text) expect(page).to have_text(note_text)
end end
context 'when group has open access requests' do
let!(:access_request) { create(:group_member, :access_request, group: group) }
it 'shows access requests with link to manage access' do
visit admin_group_path(group)
page.within '[data-testid="access-requests"]' do
expect(page).to have_content access_request.user.name
expect(page).to have_link 'Manage access', href: group_group_members_path(group, tab: 'access_requests')
end
end
end
end end
describe 'group edit' do describe 'group edit' do
......
...@@ -52,6 +52,8 @@ RSpec.describe "Admin::Projects" do ...@@ -52,6 +52,8 @@ RSpec.describe "Admin::Projects" do
end end
describe "GET /admin/projects/:namespace_id/:id" do describe "GET /admin/projects/:namespace_id/:id" do
let!(:access_request) { create(:project_member, :access_request, project: project) }
before do before do
expect(project).to be_persisted expect(project).to be_persisted
...@@ -67,6 +69,15 @@ RSpec.describe "Admin::Projects" do ...@@ -67,6 +69,15 @@ RSpec.describe "Admin::Projects" do
expect(page).to have_content(project.creator.name) expect(page).to have_content(project.creator.name)
expect(page).to have_content(project.id) expect(page).to have_content(project.id)
end end
context 'when project has open access requests' do
it 'shows access requests with link to manage access' do
page.within '[data-testid="access-requests"]' do
expect(page).to have_content access_request.user.name
expect(page).to have_link 'Manage access', href: project_project_members_path(project, tab: 'access_requests')
end
end
end
end end
describe 'transfer project' do describe 'transfer project' do
......
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