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
a8068ea6
Commit
a8068ea6
authored
Apr 14, 2020
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove project_search_by_full_path feature flag
parent
fa89dc28
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
25 deletions
+5
-25
app/models/project.rb
app/models/project.rb
+1
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+4
-24
No files found.
app/models/project.rb
View file @
a8068ea6
...
@@ -591,7 +591,7 @@ class Project < ApplicationRecord
...
@@ -591,7 +591,7 @@ class Project < ApplicationRecord
#
#
# query - The search query as a String.
# query - The search query as a String.
def
search
(
query
,
include_namespace:
false
)
def
search
(
query
,
include_namespace:
false
)
if
include_namespace
&&
Feature
.
enabled?
(
:project_search_by_full_path
,
default_enabled:
true
)
if
include_namespace
joins
(
:route
).
fuzzy_search
(
query
,
[
Route
.
arel_table
[
:path
],
Route
.
arel_table
[
:name
],
:description
])
joins
(
:route
).
fuzzy_search
(
query
,
[
Route
.
arel_table
[
:path
],
Route
.
arel_table
[
:name
],
:description
])
else
else
fuzzy_search
(
query
,
[
:path
,
:name
,
:description
])
fuzzy_search
(
query
,
[
:path
,
:name
,
:description
])
...
...
spec/models/project_spec.rb
View file @
a8068ea6
...
@@ -1740,32 +1740,12 @@ describe Project do
...
@@ -1740,32 +1740,12 @@ describe Project do
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:project
)
{
create
(
:project
,
group:
group
)
}
let_it_be
(
:project
)
{
create
(
:project
,
group:
group
)
}
context
'when feature is enabled'
do
it
'returns projects that match the group path'
do
before
do
expect
(
described_class
.
search
(
group
.
path
,
include_namespace:
true
)).
to
eq
([
project
])
stub_feature_flags
(
project_search_by_full_path:
true
)
end
it
'returns projects that match the group path'
do
expect
(
described_class
.
search
(
group
.
path
,
include_namespace:
true
)).
to
eq
([
project
])
end
it
'returns projects that match the full path'
do
expect
(
described_class
.
search
(
project
.
full_path
,
include_namespace:
true
)).
to
eq
([
project
])
end
end
end
context
'when feature is disabled'
do
it
'returns projects that match the full path'
do
before
do
expect
(
described_class
.
search
(
project
.
full_path
,
include_namespace:
true
)).
to
eq
([
project
])
stub_feature_flags
(
project_search_by_full_path:
false
)
end
it
'returns no results when searching by group path'
do
expect
(
described_class
.
search
(
group
.
path
,
include_namespace:
true
)).
to
be_empty
end
it
'returns no results when searching by full path'
do
expect
(
described_class
.
search
(
project
.
full_path
,
include_namespace:
true
)).
to
be_empty
end
end
end
end
end
...
...
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