add feature flag for users search
This commit is contained in:
parent
c36d98501b
commit
55629a2e4d
5 changed files with 20 additions and 3 deletions
|
@ -56,6 +56,8 @@ 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
|
||||
|
||||
|
|
|
@ -203,6 +203,8 @@ module SearchHelper
|
|||
end
|
||||
|
||||
def search_tabs?(tab)
|
||||
return false if Feature.disabled?(:users_search, default_enabled: true)
|
||||
|
||||
if @project
|
||||
project_search_tabs?(:members)
|
||||
else
|
||||
|
|
|
@ -23,7 +23,8 @@ module Search
|
|||
|
||||
def allowed_scopes
|
||||
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
|
||||
|
||||
|
|
|
@ -16,7 +16,12 @@ module Search
|
|||
end
|
||||
|
||||
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
|
||||
|
|
|
@ -54,7 +54,14 @@ module API
|
|||
end
|
||||
|
||||
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,
|
||||
type: String,
|
||||
|
|
Loading…
Reference in a new issue