Commit 55629a2e authored by Alexis Reigel's avatar Alexis Reigel

add feature flag for users search

parent c36d9850
...@@ -56,6 +56,8 @@ class SearchController < ApplicationController ...@@ -56,6 +56,8 @@ 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
......
...@@ -203,6 +203,8 @@ module SearchHelper ...@@ -203,6 +203,8 @@ module SearchHelper
end end
def search_tabs?(tab) def search_tabs?(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
......
...@@ -23,7 +23,8 @@ module Search ...@@ -23,7 +23,8 @@ module Search
def allowed_scopes def allowed_scopes
strong_memoize(:allowed_scopes) do strong_memoize(:allowed_scopes) do
%w[issues merge_requests milestones users] allowed_scopes = %w[issues merge_requests milestones]
allowed_scopes << 'users' if Feature.enabled?(:users_search, default_enabled: true)
end end
end end
......
...@@ -16,7 +16,12 @@ module Search ...@@ -16,7 +16,12 @@ module Search
end end
def scope def scope
@scope ||= %w[notes issues merge_requests milestones wiki_blobs commits users].delete(params[:scope]) { 'blobs' } @scope ||= begin
allowed_scopes = %w[notes issues merge_requests milestones wiki_blobs commits]
allowed_scopes << 'users' if Feature.enabled?(:users_search, default_enabled: true)
allowed_scopes.delete(params[:scope]) { 'blobs' }
end
end end
end end
end end
...@@ -54,7 +54,14 @@ module API ...@@ -54,7 +54,14 @@ module API
end end
params :scope do |options| params :scope do |options|
values = SCOPE_ENTITY.stringify_keys.slice(*options[:values]).keys scope_entities =
if Feature.enabled?(:users_search, default_enabled: true)
SCOPE_ENTITY
else
SCOPE_ENTITY.reject { |key, value| key == :users }
end
values = scope_entities.stringify_keys.slice(*options[:values]).keys
requires :scope, requires :scope,
type: String, type: String,
......
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