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