Commit 185094d8 authored by Tiger Watson's avatar Tiger Watson

Merge branch 'cngo-switch-on-new-project-page-feature-flag' into 'master'

Remove feature flag paginatable_namespace_drop_down_for_project_creation

See merge request gitlab-org/gitlab!72240
parents fb286980 a20daa48
......@@ -53,8 +53,7 @@ module Groups
end
def permission_scope_create_projects?
params[:permission_scope] == :create_projects &&
Feature.enabled?(:paginatable_namespace_drop_down_for_project_creation, current_user, default_enabled: :yaml)
params[:permission_scope] == :create_projects
end
end
end
......@@ -23,10 +23,6 @@ module Resolvers
Preloaders::GroupPolicyPreloader.new(nodes, current_user).execute
end
def ready?(**args)
Feature.enabled?(:paginatable_namespace_drop_down_for_project_creation, current_user, default_enabled: :yaml)
end
private
def resolve_groups(**args)
......
......@@ -64,8 +64,7 @@ module Types
description: 'Group memberships of the user.'
field :groups,
resolver: Resolvers::Users::GroupsResolver,
description: 'Groups where the user has access. Will always return `null` if ' \
'`paginatable_namespace_drop_down_for_project_creation` feature flag is disabled.'
description: 'Groups where the user has access.'
field :group_count,
resolver: Resolvers::Users::GroupCountResolver,
description: 'Group count for the user.'
......
......@@ -49,13 +49,6 @@ module NamespacesHelper
end
end
def namespaces_options_with_developer_maintainer_access(options = {})
selected = options.delete(:selected) || :current_user
options[:groups] = current_user.manageable_groups_with_routes(include_groups_with_developer_maintainer_access: true)
namespaces_options(selected, **options)
end
def cascading_namespace_settings_popover_data(attribute, group, settings_path_helper)
locked_by_ancestor = group.namespace_settings.public_send("#{attribute}_locked_by_ancestor?") # rubocop:disable GitlabSecurity/PublicSend
......
......@@ -15,23 +15,12 @@
.input-group.gl-flex-nowrap
- if current_user.can_select_namespace?
- namespace_id = namespace_id_from(params)
- if Feature.enabled?(:paginatable_namespace_drop_down_for_project_creation, current_user, default_enabled: :yaml)
.js-vue-new-project-url-select{ data: { namespace_full_path: GroupFinder.new(current_user).execute(id: namespace_id)&.full_path,
namespace_id: namespace_id,
root_url: root_url,
track_label: track_label,
user_namespace_full_path: current_user.namespace.full_path,
user_namespace_id: current_user.namespace.id } }
- else
.input-group-prepend.flex-shrink-0.has-tooltip{ title: root_url }
.input-group-text
= root_url
= f.select(:namespace_id,
namespaces_options_with_developer_maintainer_access(selected: namespace_id,
display_path: true,
extra_group: namespace_id),
{},
{ class: 'select2 js-select-namespace qa-project-namespace-select block-truncated', data: { track_label: "#{track_label}", track_action: "activate_form_input", track_property: "project_path", track_value: "", qa_selector: "select_namespace_dropdown" }})
.js-vue-new-project-url-select{ data: { namespace_full_path: GroupFinder.new(current_user).execute(id: namespace_id)&.full_path,
namespace_id: namespace_id,
root_url: root_url,
track_label: track_label,
user_namespace_full_path: current_user.namespace.full_path,
user_namespace_id: current_user.namespace.id } }
- else
.input-group-prepend.static-namespace.flex-shrink-0.has-tooltip{ title: user_url(current_user.username) + '/' }
.input-group-text.border-0
......
---
name: paginatable_namespace_drop_down_for_project_creation
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66112
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/338930
milestone: '14.3'
type: development
group: group::project management
default_enabled: true
......@@ -12078,7 +12078,7 @@ four standard [pagination arguments](#connection-pagination-arguments):
##### `MergeRequestAssignee.groups`
Groups where the user has access. Will always return `null` if `paginatable_namespace_drop_down_for_project_creation` feature flag is disabled.
Groups where the user has access.
Returns [`GroupConnection`](#groupconnection).
......@@ -12330,7 +12330,7 @@ four standard [pagination arguments](#connection-pagination-arguments):
##### `MergeRequestReviewer.groups`
Groups where the user has access. Will always return `null` if `paginatable_namespace_drop_down_for_project_creation` feature flag is disabled.
Groups where the user has access.
Returns [`GroupConnection`](#groupconnection).
......@@ -15509,7 +15509,7 @@ four standard [pagination arguments](#connection-pagination-arguments):
##### `UserCore.groups`
Groups where the user has access. Will always return `null` if `paginatable_namespace_drop_down_for_project_creation` feature flag is disabled.
Groups where the user has access.
Returns [`GroupConnection`](#groupconnection).
......@@ -18741,7 +18741,7 @@ four standard [pagination arguments](#connection-pagination-arguments):
###### `User.groups`
Groups where the user has access. Will always return `null` if `paginatable_namespace_drop_down_for_project_creation` feature flag is disabled.
Groups where the user has access.
Returns [`GroupConnection`](#groupconnection).
......@@ -6,7 +6,6 @@ RSpec.describe 'New project', :js do
let(:user) { create(:admin) }
before do
stub_feature_flags(paginatable_namespace_drop_down_for_project_creation: false)
sign_in(user)
end
......@@ -235,20 +234,23 @@ RSpec.describe 'New project', :js do
page.find(".template-option input[value='#{subgroup1_project1.id}']").first(:xpath, './/..').click
wait_for_all_requests
end
# Open Project URL dropdown
click_button group1.name
end
context 'when template is selected' do
context 'namespace selector' do
it "only shows the template's group hierarchy options" do
page.within('#create-from-template-pane') do
elements = page.find_all("#project_namespace_id option:not(.hidden)", visible: false).map { |e| e['data-name'] }
expect(elements).to contain_exactly(group1.name, subgroup1.name, subsubgroup1.name)
elements = find_all('.gl-new-dropdown-item-text-wrapper').map { |e| e['innerText'] }
expect(elements).to contain_exactly(group1.full_path, subgroup1.full_path, subsubgroup1.full_path)
end
end
it 'does not show the user namespace options' do
page.within('#create-from-template-pane') do
expect(page.find_all("#project_namespace_id optgroup.hidden[label='Users']", visible: false)).not_to be_empty
expect(page).not_to have_text 'Users'
end
end
end
......@@ -262,16 +264,17 @@ RSpec.describe 'New project', :js do
click_button 'Change template'
page.find(:xpath, "//input[@type='radio' and @value='#{subgroup1_project1.id}']/..").click
wait_for_all_requests
end
# Open Project URL dropdown
click_button group1.name
end
it 'list the appropriate groups' do
page.within('#create-from-template-pane') do
elements = page.find_all("#project_namespace_id option:not(.hidden)", visible: false).map { |e| e['data-name'] }
expect(elements).to contain_exactly(group1.name, subgroup1.name, subsubgroup1.name)
elements = find_all('.gl-new-dropdown-item-text-wrapper').map { |e| e['innerText'] }
expect(elements).to contain_exactly(group1.full_path, subgroup1.full_path, subsubgroup1.full_path)
end
end
end
......
......@@ -14,7 +14,6 @@ module QA
view 'app/views/projects/_new_project_fields.html.haml' do
element :initialize_with_readme_checkbox
element :initialize_with_sast_checkbox
element :project_namespace_field, 'namespaces_options' # rubocop:disable QA/ElementWithPattern
element :project_name, 'text_field :name' # rubocop:disable QA/ElementWithPattern
element :project_path, 'text_field :path' # rubocop:disable QA/ElementWithPattern
element :project_description, 'text_area :description' # rubocop:disable QA/ElementWithPattern
......
......@@ -2,7 +2,7 @@
module QA
RSpec.describe 'Manage', :smoke do
describe 'Project', :requires_admin do
describe 'Project' do
shared_examples 'successful project creation' do
it 'creates a new project' do
Page::Project::Show.perform do |project_page|
......@@ -17,7 +17,6 @@ module QA
end
before do
Runtime::Feature.enable(:paginatable_namespace_drop_down_for_project_creation)
Flow::Login.sign_in
project
end
......
......@@ -2,8 +2,7 @@
module QA
RSpec.describe 'Package' do
# TODO: Remove :requires_admin when the `Runtime::Feature.enable` method call is removed
describe 'Container Registry Online Garbage Collection', :registry_gc, :requires_admin, only: { subdomain: %i[pre] } do
describe 'Container Registry Online Garbage Collection', :registry_gc, only: { subdomain: %i[pre] } do
let(:group) { Resource::Group.fabricate_via_api! }
let(:imported_project) do
......@@ -65,8 +64,6 @@ module QA
end
before do
Runtime::Feature.enable(:paginatable_namespace_drop_down_for_project_creation)
Flow::Login.sign_in
imported_project
......
......@@ -11,7 +11,7 @@ module QA
end
end
describe 'Project', :requires_admin do
describe 'Project' do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'awesome-project'
......@@ -20,7 +20,6 @@ module QA
end
before do
Runtime::Feature.enable(:paginatable_namespace_drop_down_for_project_creation)
sign_in
end
......
......@@ -2,7 +2,7 @@
module QA
RSpec.describe 'Manage' do
describe 'Project templates', :requires_admin, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/350279', type: :investigating } do
describe 'Project templates', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/350279', type: :investigating } do
include Support::API
before(:all) do
......@@ -36,10 +36,6 @@ module QA
end
end
before do
Runtime::Feature.enable(:paginatable_namespace_drop_down_for_project_creation)
end
context 'built-in', :requires_admin do
before do
Flow::Login.sign_in_as_admin
......
......@@ -10,12 +10,11 @@ RSpec.describe 'Import/Export - project import integration test', :js do
let(:export_path) { "#{Dir.tmpdir}/import_file_spec" }
before do
stub_feature_flags(paginatable_namespace_drop_down_for_project_creation: false)
stub_uploads_object_storage(FileUploader)
allow_next_instance_of(Gitlab::ImportExport) do |instance|
allow(instance).to receive(:storage_path).and_return(export_path)
end
gitlab_sign_in(user)
sign_in(user)
end
after do
......
......@@ -6,10 +6,6 @@ RSpec.describe 'New project', :js do
include Select2Helper
include Spec::Support::Helpers::Features::TopNavSpecHelpers
before do
stub_feature_flags(paginatable_namespace_drop_down_for_project_creation: false)
end
context 'as a user' do
let(:user) { create(:user) }
......@@ -179,7 +175,7 @@ RSpec.describe 'New project', :js do
it 'does not show the initialize with Readme checkbox on "Import project" tab' do
visit new_project_path
click_link 'Import project'
first('.js-import-git-toggle-button').click
click_button 'Repo by URL'
page.within '#import-project-pane' do
expect(page).not_to have_css('input#project_initialize_with_readme')
......@@ -196,9 +192,7 @@ RSpec.describe 'New project', :js do
end
it 'selects the user namespace' do
page.within('#blank-project-pane') do
expect(page).to have_select('project[namespace_id]', visible: false, selected: user.username)
end
expect(page).to have_button user.username
end
end
......@@ -212,9 +206,7 @@ RSpec.describe 'New project', :js do
end
it 'selects the group namespace' do
page.within('#blank-project-pane') do
expect(page).to have_select('project[namespace_id]', visible: false, selected: group.name)
end
expect(page).to have_button group.name
end
end
......@@ -229,9 +221,7 @@ RSpec.describe 'New project', :js do
end
it 'selects the group namespace' do
page.within('#blank-project-pane') do
expect(page).to have_select('project[namespace_id]', visible: false, selected: subgroup.full_path)
end
expect(page).to have_button subgroup.full_path
end
end
......@@ -249,22 +239,30 @@ RSpec.describe 'New project', :js do
end
it 'enables the correct visibility options' do
select2(user.namespace_id, from: '#project_namespace_id')
click_button public_group.full_path
click_button user.username
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::PRIVATE}")).not_to be_disabled
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::INTERNAL}")).not_to be_disabled
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::PUBLIC}")).not_to be_disabled
select2(public_group.id, from: '#project_namespace_id')
click_button user.username
click_button public_group.full_path
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::PRIVATE}")).not_to be_disabled
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::INTERNAL}")).not_to be_disabled
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::PUBLIC}")).not_to be_disabled
select2(internal_group.id, from: '#project_namespace_id')
click_button public_group.full_path
click_button internal_group.full_path
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::PRIVATE}")).not_to be_disabled
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::INTERNAL}")).not_to be_disabled
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::PUBLIC}")).to be_disabled
select2(private_group.id, from: '#project_namespace_id')
click_button internal_group.full_path
click_button private_group.full_path
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::PRIVATE}")).not_to be_disabled
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::INTERNAL}")).to be_disabled
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::PUBLIC}")).to be_disabled
......@@ -355,9 +353,7 @@ RSpec.describe 'New project', :js do
end
it 'selects the group namespace' do
page.within('#blank-project-pane') do
expect(page).to have_select('project[namespace_id]', visible: false, selected: group.full_path)
end
expect(page).to have_button group.full_path
end
end
end
......
......@@ -6,7 +6,6 @@ RSpec.describe 'User creates a project', :js do
let(:user) { create(:user) }
before do
stub_feature_flags(paginatable_namespace_drop_down_for_project_creation: false)
sign_in(user)
create(:personal_key, user: user)
end
......@@ -44,9 +43,7 @@ RSpec.describe 'User creates a project', :js do
expect(page).to have_checked_field 'Initialize repository with a README'
expect(page).to have_checked_field 'Enable Static Application Security Testing (SAST)'
page.within('#content-body') do
click_button('Create project')
end
click_button('Create project')
project = Project.last
......@@ -96,12 +93,10 @@ RSpec.describe 'User creates a project', :js do
fill_in :project_name, with: 'A Subgroup Project'
fill_in :project_path, with: 'a-subgroup-project'
page.find('.js-select-namespace').click
page.find("div[role='option']", text: subgroup.full_path).click
click_button user.username
click_button subgroup.full_path
page.within('#content-body') do
click_button('Create project')
end
click_button('Create project')
expect(page).to have_content("Project 'A Subgroup Project' was successfully created")
......@@ -125,8 +120,8 @@ RSpec.describe 'User creates a project', :js do
fill_in :project_name, with: 'a-new-project'
fill_in :project_path, with: 'a-new-project'
page.find('.js-select-namespace').click
page.find("div[role='option']", text: group.full_path).click
click_button user.username
click_button group.full_path
page.within('#content-body') do
click_button('Create project')
......
......@@ -59,23 +59,6 @@ RSpec.describe Groups::UserGroupsFinder do
)
end
context 'when paginatable_namespace_drop_down_for_project_creation feature flag is disabled' do
before do
stub_feature_flags(paginatable_namespace_drop_down_for_project_creation: false)
end
it 'ignores project creation scope and returns all groups where the user is a direct member' do
is_expected.to match(
[
public_maintainer_group,
private_maintainer_group,
public_developer_group,
guest_group
]
)
end
end
context 'when search is provided' do
let(:arguments) { { permission_scope: :create_projects, search: 'maintainer' } }
......
......@@ -26,14 +26,6 @@ RSpec.describe Resolvers::Users::GroupsResolver do
public_maintainer_group.add_maintainer(user)
end
context 'when paginatable_namespace_drop_down_for_project_creation feature flag is disabled' do
before do
stub_feature_flags(paginatable_namespace_drop_down_for_project_creation: false)
end
it { is_expected.to be_nil }
end
context 'when resolver object is current user' do
context 'when permission is :create_projects' do
let(:group_arguments) { { permission_scope: :create_projects } }
......
......@@ -188,44 +188,6 @@ RSpec.describe NamespacesHelper do
helper.namespaces_options
end
end
describe 'include_groups_with_developer_maintainer_access parameter' do
context 'when DEVELOPER_MAINTAINER_PROJECT_ACCESS is set for a project' do
let!(:admin_project_creation_level) { ::Gitlab::Access::DEVELOPER_MAINTAINER_PROJECT_ACCESS }
it 'returns groups where user is a developer' do
allow(helper).to receive(:current_user).and_return(user)
stub_application_setting(default_project_creation: ::Gitlab::Access::MAINTAINER_PROJECT_ACCESS)
admin_group.add_user(user, GroupMember::DEVELOPER)
options = helper.namespaces_options_with_developer_maintainer_access
expect(options).to include(admin_group.name)
expect(options).not_to include(subgroup1.name)
expect(options).to include(subgroup2.name)
expect(options).not_to include(subgroup3.name)
expect(options).to include(user_group.name)
expect(options).to include(user.name)
end
end
context 'when DEVELOPER_MAINTAINER_PROJECT_ACCESS is set globally' do
it 'return groups where default is not overridden' do
allow(helper).to receive(:current_user).and_return(user)
stub_application_setting(default_project_creation: ::Gitlab::Access::DEVELOPER_MAINTAINER_PROJECT_ACCESS)
admin_group.add_user(user, GroupMember::DEVELOPER)
options = helper.namespaces_options_with_developer_maintainer_access
expect(options).to include(admin_group.name)
expect(options).to include(subgroup1.name)
expect(options).to include(subgroup2.name)
expect(options).not_to include(subgroup3.name)
expect(options).to include(user_group.name)
expect(options).to include(user.name)
end
end
end
end
describe '#cascading_namespace_settings_popover_data' 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