Commit b7faa327 authored by peterhegman's avatar peterhegman Committed by Brandon Labuschagne

Remove access request controls in admin area

Remove access request controls in admin area and instead add a link to
the members page with the "Access requests" tab pre-selected.

Changelog: changed
parent fbf5cf2f
......@@ -128,10 +128,7 @@
.card-header
= html_escape(_("%{group_name} group members")) % { group_name: "<strong>#{html_escape(@group.name)}</strong>".html_safe }
%span.badge.badge-pill= @group.users_count
.float-right
= 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')
= render 'shared/members/manage_access_button', path: group_group_members_path(@group)
%ul.content-list.group-users-list.content-list.members-list
= render partial: 'shared/members/member',
collection: @members, as: :member,
......
......@@ -180,10 +180,7 @@
%strong= @group.name
= _('group members')
%span.badge.badge-pill= @group_members.size
.float-right
= 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')
= render 'shared/members/manage_access_button', path: group_group_members_path(@group)
%ul.content-list.members-list
= render partial: 'shared/members/member',
collection: @group_members, as: :member,
......@@ -194,17 +191,14 @@
.card-footer
= 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-header
%strong= @project.name
= _('project members')
%span.badge.badge-pill= @project.users.size
.float-right
= 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')
= render 'shared/members/manage_access_button', path: project_project_members_path(@project)
%ul.content-list.project_members.members-list
= render partial: 'shared/members/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)
- requesters = local_assigns.fetch(:requesters)
- force_mobile_view = local_assigns.fetch(:force_mobile_view, false)
- group = local_assigns.fetch(:group)
- current_user_is_group_owner = group && group.has_owner?(current_user)
- 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
= _("Users requesting access to")
%strong= membership_source.name
%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
= render partial: 'shared/members/member',
collection: requesters, as: :member,
locals: { membership_source: membership_source,
group: group,
force_mobile_view: force_mobile_view,
show_controls: false,
current_user_is_group_owner: current_user_is_group_owner }
......@@ -132,6 +132,19 @@ RSpec.describe 'Admin Groups' do
expect(page).to have_text(note_text)
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
describe 'group edit' do
......
......@@ -52,6 +52,8 @@ RSpec.describe "Admin::Projects" do
end
describe "GET /admin/projects/:namespace_id/:id" do
let!(:access_request) { create(:project_member, :access_request, project: project) }
before do
expect(project).to be_persisted
......@@ -67,6 +69,15 @@ RSpec.describe "Admin::Projects" do
expect(page).to have_content(project.creator.name)
expect(page).to have_content(project.id)
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
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