diff options
author | Jose Ivan Vargas <jvargas@gitlab.com> | 2016-12-26 10:12:24 -0600 |
---|---|---|
committer | Jose Ivan Vargas <jvargas@gitlab.com> | 2017-01-03 10:52:14 -0600 |
commit | 57b5612aaa6fd243f18587acbf0a8ebbb37551f2 (patch) | |
tree | e3353bacabf62f5b086d22e5319cdc15d957fd51 | |
parent | ad58dec2e1564e9c2d23dd32e5da8b12eeba965d (diff) | |
download | gitlab-ce-57b5612aaa6fd243f18587acbf0a8ebbb37551f2.tar.gz |
Removed the "Groups" option from the settings gear
Fixed more tests
-rw-r--r-- | app/controllers/projects/settings/members_controller.rb | 4 | ||||
-rw-r--r-- | app/finders/members_finder.rb | 10 | ||||
-rw-r--r-- | app/views/layouts/nav/_project_settings.html.haml | 5 | ||||
-rw-r--r-- | app/views/projects/settings/members/show.html.haml | 4 | ||||
-rw-r--r-- | spec/controllers/projects/project_members_controller_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/projects/group_links_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/projects/members/group_links_spec.rb | 4 |
7 files changed, 15 insertions, 18 deletions
diff --git a/app/controllers/projects/settings/members_controller.rb b/app/controllers/projects/settings/members_controller.rb index 766a01ba5e1..5735e281f66 100644 --- a/app/controllers/projects/settings/members_controller.rb +++ b/app/controllers/projects/settings/members_controller.rb @@ -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? diff --git a/app/finders/members_finder.rb b/app/finders/members_finder.rb index b476b0bc184..702944404f5 100644 --- a/app/finders/members_finder.rb +++ b/app/finders/members_finder.rb @@ -1,13 +1,13 @@ 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 diff --git a/app/views/layouts/nav/_project_settings.html.haml b/app/views/layouts/nav/_project_settings.html.haml index 42d5a8f92ba..0fb2bb460cb 100644 --- a/app/views/layouts/nav/_project_settings.html.haml +++ b/app/views/layouts/nav/_project_settings.html.haml @@ -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 diff --git a/app/views/projects/settings/members/show.html.haml b/app/views/projects/settings/members/show.html.haml index 78d6293b76b..d81ed7bb609 100644 --- a/app/views/projects/settings/members/show.html.haml +++ b/app/views/projects/settings/members/show.html.haml @@ -1,4 +1,6 @@ - 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" diff --git a/spec/controllers/projects/project_members_controller_spec.rb b/spec/controllers/projects/project_members_controller_spec.rb index 6fa7bbd6dae..442f81187dc 100644 --- a/spec/controllers/projects/project_members_controller_spec.rb +++ b/spec/controllers/projects/project_members_controller_spec.rb @@ -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 diff --git a/spec/features/projects/group_links_spec.rb b/spec/features/projects/group_links_spec.rb index 1a71a03fbd9..32e68ab817b 100644 --- a/spec/features/projects/group_links_spec.rb +++ b/spec/features/projects/group_links_spec.rb @@ -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') diff --git a/spec/features/projects/members/group_links_spec.rb b/spec/features/projects/members/group_links_spec.rb index 94995f7cf95..cffb935ad5a 100644 --- a/spec/features/projects/members/group_links_spec.rb +++ b/spec/features/projects/members/group_links_spec.rb @@ -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 |