Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
55629a2e
Commit
55629a2e
authored
Dec 19, 2018
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add feature flag for users search
parent
c36d9850
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
3 deletions
+20
-3
app/controllers/search_controller.rb
app/controllers/search_controller.rb
+2
-0
app/helpers/search_helper.rb
app/helpers/search_helper.rb
+2
-0
app/services/search/global_service.rb
app/services/search/global_service.rb
+2
-1
app/services/search/project_service.rb
app/services/search/project_service.rb
+6
-1
lib/api/search.rb
lib/api/search.rb
+8
-1
No files found.
app/controllers/search_controller.rb
View file @
55629a2e
...
...
@@ -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
...
...
app/helpers/search_helper.rb
View file @
55629a2e
...
...
@@ -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
...
...
app/services/search/global_service.rb
View file @
55629a2e
...
...
@@ -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
...
...
app/services/search/project_service.rb
View file @
55629a2e
...
...
@@ -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
lib/api/search.rb
View file @
55629a2e
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment