Commit 57b5612a authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Removed the "Groups" option from the settings gear

Fixed more tests
parent ad58dec2
......@@ -16,14 +16,14 @@ module Projects
@group_links = @project.project_group_links.all
@skip_groups = @group_links.pluck(:group_id)
@skip_groups << @project.namespace_id unless project.personal?
@skip_groups << @project.namespace_id unless @project.personal?
if group
# We need `.where.not(user_id: nil)` here otherwise when a group has an
# invitee, it would make the following query return 0 rows since a NULL
# user_id would be present in the subquery
# See http://stackoverflow.com/questions/129077/not-in-clause-and-null-values
group_members = MembersFinder.new(@project, @group)
group_members = MembersFinder.new(@project_members, group).execute(current_user)
end
if params[:search].present?
......
class MembersFinder < Projects::ApplicationController
def initialize(project_members, group)
def initialize(project_members, project_group)
@project_members = project_members
@group = group
@project_group = project_group
end
def execute
def execute(current_user)
non_null_user_ids = @project_members.where.not(user_id: nil).select(:user_id)
group_members = @group.group_members.where.not(user_id: non_null_user_ids)
group_members = group_members.non_invite unless can?(current_user, :admin_group, @group)
group_members = @project_group.group_members.where.not(user_id: non_null_user_ids)
group_members = group_members.non_invite unless can?(current_user, :admin_group, @project_group)
group_members
end
end
......@@ -4,11 +4,6 @@
%span
Members
- if can_edit
- if @project.allowed_to_share_with_group?
= nav_link(controller: :group_links) do
= link_to namespace_project_group_links_path(@project.namespace, @project), title: "Groups" do
%span
Groups
= nav_link(controller: :deploy_keys) do
= link_to namespace_project_deploy_keys_path(@project.namespace, @project), title: 'Deploy Keys' do
%span
......
- page_title "Members"
= render "projects/project_members/index"
= render "projects/group_links/index"
- if can?(current_user, :admin_project, @project)
- if @project.allowed_to_share_with_group?
= render "projects/group_links/index"
......@@ -5,11 +5,11 @@ describe Projects::ProjectMembersController do
let(:project) { create(:empty_project, :public, :access_requestable) }
describe 'GET index' do
it 'redirects to settings/members with 302 status code' do
it 'should have the settings/members address with a 302 status code' do
get :index, namespace_id: project.namespace, project_id: project
expect(response).to have_http_status(302)
expect(response).to redirect_to(namespace_project_settings_members_path(project.namespace, project))
expect(response.location).to include namespace_project_settings_members_path(project.namespace, project)
end
end
......
......@@ -14,7 +14,7 @@ feature 'Project group links', feature: true, js: true do
context 'setting an expiration date for a group link' do
before do
visit namespace_project_group_links_path(project.namespace, project)
visit namespace_project_settings_members_path(project.namespace, project)
select2 group.id, from: '#link_group_id'
fill_in 'expires_at', with: (Time.current + 4.5.days).strftime('%Y-%m-%d')
......
......@@ -12,7 +12,7 @@ feature 'Projects > Members > Anonymous user sees members', feature: true, js: t
@group_link = create(:project_group_link, project: project, group: group)
login_as(user)
visit namespace_project_project_members_path(project.namespace, project)
visit namespace_project_settings_members_path(project.namespace, project)
end
it 'updates group access level' do
......@@ -24,7 +24,7 @@ feature 'Projects > Members > Anonymous user sees members', feature: true, js: t
wait_for_ajax
visit namespace_project_project_members_path(project.namespace, project)
visit namespace_project_settings_members_path(project.namespace, project)
expect(first('.group_member')).to have_content('Guest')
end
......
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