Commit f6ba3d41 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'remove-users-search-ff' into 'master'

Remove `users_search` feature flag

See merge request gitlab-org/gitlab!43513
parents 7288200e 233cb4b6
......@@ -97,8 +97,6 @@ class SearchController < ApplicationController
end
def eager_load_user_status
return if Feature.disabled?(:users_search, default_enabled: true)
@search_objects = @search_objects.eager_load(:status) # rubocop:disable CodeReuse/ActiveRecord
end
......
......@@ -305,8 +305,6 @@ module SearchHelper
end
def show_user_search_tab?
return false if Feature.disabled?(:users_search, default_enabled: true)
if @project
project_search_tabs?(:members)
else
......
......@@ -4,6 +4,8 @@ module Search
class GlobalService
include Gitlab::Utils::StrongMemoize
ALLOWED_SCOPES = %w(issues merge_requests milestones users).freeze
attr_accessor :current_user, :params
def initialize(user, params)
......@@ -23,11 +25,7 @@ module Search
end
def allowed_scopes
strong_memoize(:allowed_scopes) do
allowed_scopes = %w[issues merge_requests milestones]
allowed_scopes << 'users' if Feature.enabled?(:users_search, default_enabled: true)
allowed_scopes
end
ALLOWED_SCOPES
end
def scope
......
......@@ -2,6 +2,10 @@
module Search
class ProjectService
include Gitlab::Utils::StrongMemoize
ALLOWED_SCOPES = %w(notes issues merge_requests milestones wiki_blobs commits users).freeze
attr_accessor :project, :current_user, :params
def initialize(project, user, params)
......@@ -17,12 +21,13 @@ module Search
)
end
def scope
@scope ||= begin
allowed_scopes = %w[notes issues merge_requests milestones wiki_blobs commits]
allowed_scopes << 'users' if Feature.enabled?(:users_search, default_enabled: true)
def allowed_scopes
ALLOWED_SCOPES
end
allowed_scopes.delete(params[:scope]) { 'blobs' }
def scope
strong_memoize(:scope) do
allowed_scopes.include?(params[:scope]) ? params[:scope] : 'blobs'
end
end
end
......
---
name: users_search
introduced_by_url:
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/255282
group: group::global search
type: development
default_enabled: true
......@@ -53,9 +53,7 @@ module EE
return super unless use_elasticsearch?
strong_memoize(:ee_allowed_scopes) do
super.tap do |ce_scopes|
ce_scopes.concat(%w[notes wiki_blobs blobs commits])
end
super + %w[notes wiki_blobs blobs commits]
end
end
end
......
......@@ -36,14 +36,10 @@ module EE
override :allowed_scopes
def allowed_scopes
return super unless ::Feature.enabled?(:epics_search) && group.feature_available?(:epics)
strong_memoize(:ee_group_allowed_scopes) do
super.tap do |scopes|
if ::Feature.enabled?(:epics_search) && group.feature_available?(:epics)
scopes << 'epics'
else
scopes
end
end
super + %w(epics)
end
end
end
......
......@@ -62,12 +62,6 @@ module API
# Defining this method here as a noop allows us to easily extend it in
# EE, without having to modify this file directly.
end
def check_users_search_allowed!
if params[:scope].to_sym == :users && Feature.disabled?(:users_search, default_enabled: true)
render_api_error!({ error: _("Scope not supported with disabled 'users_search' feature!") }, 400)
end
end
end
resource :search do
......@@ -85,7 +79,6 @@ module API
end
get do
verify_search_scope!(resource: nil)
check_users_search_allowed!
present search, with: entity
end
......@@ -107,7 +100,6 @@ module API
end
get ':id/(-/)search' do
verify_search_scope!(resource: user_group)
check_users_search_allowed!
present search(group_id: user_group.id), with: entity
end
......@@ -129,8 +121,6 @@ module API
use :pagination
end
get ':id/(-/)search' do
check_users_search_allowed!
present search({ project_id: user_project.id, repository_ref: params[:ref] }), with: entity
end
end
......
......@@ -22301,9 +22301,6 @@ msgstr ""
msgid "Scope"
msgstr ""
msgid "Scope not supported with disabled 'users_search' feature!"
msgstr ""
msgid "Scoped issue boards"
msgstr ""
......
......@@ -357,14 +357,6 @@ RSpec.describe SearchHelper do
describe '#show_user_search_tab?' do
subject { show_user_search_tab? }
context 'when users_search feature is disabled' do
before do
stub_feature_flags(users_search: false)
end
it { is_expected.to eq(false) }
end
context 'when project search' do
before do
@project = :some_project
......
......@@ -231,18 +231,6 @@ RSpec.describe API::Search do
it_behaves_like 'pagination', scope: :users
it_behaves_like 'ping counters', scope: :users
context 'when users search feature is disabled' do
before do
stub_feature_flags(users_search: false)
get api(endpoint, user), params: { scope: 'users', search: 'billy' }
end
it 'returns 400 error' do
expect(response).to have_gitlab_http_status(:bad_request)
end
end
end
context 'for snippet_titles scope' do
......@@ -416,18 +404,6 @@ RSpec.describe API::Search do
include_examples 'pagination', scope: :users
end
context 'when users search feature is disabled' do
before do
stub_feature_flags(users_search: false)
get api(endpoint, user), params: { scope: 'users', search: 'billy' }
end
it 'returns 400 error' do
expect(response).to have_gitlab_http_status(:bad_request)
end
end
end
context 'for users scope with group path as id' do
......@@ -589,18 +565,6 @@ RSpec.describe API::Search do
include_examples 'pagination', scope: :users
end
context 'when users search feature is disabled' do
before do
stub_feature_flags(users_search: false)
get api(endpoint, user), params: { scope: 'users', search: 'billy' }
end
it 'returns 400 error' do
expect(response).to have_gitlab_http_status(:bad_request)
end
end
end
context 'for notes scope' 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