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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
fe56c85b
Commit
fe56c85b
authored
Oct 30, 2019
by
Dylan Griffith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature flag for switch to basic search
parent
3a5b691b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
9 deletions
+28
-9
ee/app/helpers/ee/search_helper.rb
ee/app/helpers/ee/search_helper.rb
+5
-6
ee/app/views/search/_form_revert_to_basic.html.haml
ee/app/views/search/_form_revert_to_basic.html.haml
+1
-1
ee/spec/helpers/search_helper_spec.rb
ee/spec/helpers/search_helper_spec.rb
+22
-2
No files found.
ee/app/helpers/ee/search_helper.rb
View file @
fe56c85b
...
...
@@ -70,14 +70,13 @@ module EE
search_path
(
search_params
)
end
# Switching to basic search should only be possible for a subset of
# scopes. This method assumes you're already allowed to search within
# this scope but it's just here to determine if you can switch to basic
# search.
def
switch_to_basic_searchable_tab?
(
scope
)
def
show_switch_to_basic_search?
(
search_service
)
return
false
unless
::
Feature
.
enabled?
(
:switch_to_basic_search
,
default_enabled:
false
)
return
false
unless
search_service
.
use_elasticsearch?
return
true
if
@project
scope
.
in?
(
SWITCH_TO_BASIC_SEARCHABLE_TABS
)
s
earch_service
.
s
cope
.
in?
(
SWITCH_TO_BASIC_SEARCHABLE_TABS
)
end
private
...
...
ee/app/views/search/_form_revert_to_basic.html.haml
View file @
fe56c85b
-
if
s
earch_service
.
use_elasticsearch?
&&
switch_to_basic_searchable_tab?
(
search_service
.
scop
e
)
-
if
s
how_switch_to_basic_search?
(
search_servic
e
)
-
begin_link
=
'<a href="%{url}">'
.
html_safe
%
{
url:
revert_to_basic_search_filter_url
}
-
end_link
=
'</a>'
.
html_safe
%p
.text-center
...
...
ee/spec/helpers/search_helper_spec.rb
View file @
fe56c85b
...
...
@@ -176,9 +176,29 @@ describe SearchHelper do
end
end
describe
'#switch_to_basic_searchable_tab?'
do
describe
'#show_switch_to_basic_search?'
do
let
(
:use_elasticsearch
)
{
true
}
let
(
:scope
)
{
'commits'
}
subject
{
switch_to_basic_searchable_tab?
(
scope
)
}
let
(
:search_service
)
{
instance_double
(
Search
::
GlobalService
,
use_elasticsearch?:
use_elasticsearch
,
scope:
scope
)
}
subject
{
show_switch_to_basic_search?
(
search_service
)
}
before
do
stub_feature_flags
(
switch_to_basic_search:
true
)
end
context
'when :switch_to_basic_search feature is disabled'
do
before
do
stub_feature_flags
(
switch_to_basic_search:
false
)
end
it
{
is_expected
.
to
eq
(
false
)
}
end
context
'when not currently using elasticsearch'
do
let
(
:use_elasticsearch
)
{
false
}
it
{
is_expected
.
to
eq
(
false
)
}
end
context
'when project scope'
do
before
do
...
...
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