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
0e170b0c
Commit
0e170b0c
authored
Sep 15, 2021
by
Jake Lear
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Isolate disable anonymous project search to its own FF
parent
dec0df95
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
13 deletions
+22
-13
app/controllers/explore/projects_controller.rb
app/controllers/explore/projects_controller.rb
+1
-1
app/finders/projects_finder.rb
app/finders/projects_finder.rb
+1
-1
config/feature_flags/ops/disable_anonymous_project_search.yml
...ig/feature_flags/ops/disable_anonymous_project_search.yml
+8
-0
spec/controllers/explore/projects_controller_spec.rb
spec/controllers/explore/projects_controller_spec.rb
+6
-6
spec/finders/projects_finder_spec.rb
spec/finders/projects_finder_spec.rb
+4
-4
spec/spec_helper.rb
spec/spec_helper.rb
+2
-1
No files found.
app/controllers/explore/projects_controller.rb
View file @
0e170b0c
...
@@ -123,7 +123,7 @@ class Explore::ProjectsController < Explore::ApplicationController
...
@@ -123,7 +123,7 @@ class Explore::ProjectsController < Explore::ApplicationController
end
end
def
show_alert_if_search_is_disabled
def
show_alert_if_search_is_disabled
return
if
current_user
||
params
[
:name
].
blank?
&&
params
[
:search
].
blank?
||
!
html_request?
||
Feature
.
disabled?
(
:disable_anonymous_search
,
type: :ops
)
return
if
current_user
||
params
[
:name
].
blank?
&&
params
[
:search
].
blank?
||
!
html_request?
||
Feature
.
disabled?
(
:disable_anonymous_
project_
search
,
type: :ops
)
flash
[
:notice
]
=
_
(
'You must sign in to search for specific projects.'
)
flash
[
:notice
]
=
_
(
'You must sign in to search for specific projects.'
)
end
end
...
...
app/finders/projects_finder.rb
View file @
0e170b0c
...
@@ -193,7 +193,7 @@ class ProjectsFinder < UnionFinder
...
@@ -193,7 +193,7 @@ class ProjectsFinder < UnionFinder
def
by_search
(
items
)
def
by_search
(
items
)
params
[
:search
]
||=
params
[
:name
]
params
[
:search
]
||=
params
[
:name
]
return
items
if
Feature
.
enabled?
(
:disable_anonymous_search
,
type: :ops
)
&&
current_user
.
nil?
return
items
if
Feature
.
enabled?
(
:disable_anonymous_
project_
search
,
type: :ops
)
&&
current_user
.
nil?
return
items
.
none
if
params
[
:search
].
present?
&&
params
[
:minimum_search_length
].
present?
&&
params
[
:search
].
length
<
params
[
:minimum_search_length
].
to_i
return
items
.
none
if
params
[
:search
].
present?
&&
params
[
:minimum_search_length
].
present?
&&
params
[
:search
].
length
<
params
[
:minimum_search_length
].
to_i
items
.
optionally_search
(
params
[
:search
],
include_namespace:
params
[
:search_namespaces
].
present?
)
items
.
optionally_search
(
params
[
:search
],
include_namespace:
params
[
:search_namespaces
].
present?
)
...
...
config/feature_flags/ops/disable_anonymous_project_search.yml
0 → 100644
View file @
0e170b0c
---
name
:
disable_anonymous_project_search
introduced_by_url
:
rollout_issue_url
:
milestone
:
'
14.3'
type
:
ops
group
:
group::project management
default_enabled
:
false
spec/controllers/explore/projects_controller_spec.rb
View file @
0e170b0c
...
@@ -205,9 +205,9 @@ RSpec.describe Explore::ProjectsController do
...
@@ -205,9 +205,9 @@ RSpec.describe Explore::ProjectsController do
let
(
:controller_action
)
{
:index
}
let
(
:controller_action
)
{
:index
}
let
(
:params_with_name
)
{
{
name:
'some project'
}
}
let
(
:params_with_name
)
{
{
name:
'some project'
}
}
context
'when disable_anonymous_search is enabled'
do
context
'when disable_anonymous_
project_
search is enabled'
do
before
do
before
do
stub_feature_flags
(
disable_anonymous_search:
true
)
stub_feature_flags
(
disable_anonymous_
project_
search:
true
)
end
end
it
'does not show a flash message'
do
it
'does not show a flash message'
do
...
@@ -252,9 +252,9 @@ RSpec.describe Explore::ProjectsController do
...
@@ -252,9 +252,9 @@ RSpec.describe Explore::ProjectsController do
let
(
:controller_action
)
{
:index
}
let
(
:controller_action
)
{
:index
}
let
(
:params_with_name
)
{
{
name:
'some project'
}
}
let
(
:params_with_name
)
{
{
name:
'some project'
}
}
context
'when disable_anonymous_search is enabled'
do
context
'when disable_anonymous_
project_
search is enabled'
do
before
do
before
do
stub_feature_flags
(
disable_anonymous_search:
true
)
stub_feature_flags
(
disable_anonymous_
project_
search:
true
)
end
end
it
'shows a flash message'
do
it
'shows a flash message'
do
...
@@ -280,9 +280,9 @@ RSpec.describe Explore::ProjectsController do
...
@@ -280,9 +280,9 @@ RSpec.describe Explore::ProjectsController do
end
end
end
end
context
'when disable_anonymous_search is disabled'
do
context
'when disable_anonymous_
project_
search is disabled'
do
before
do
before
do
stub_feature_flags
(
disable_anonymous_search:
false
)
stub_feature_flags
(
disable_anonymous_
project_
search:
false
)
end
end
it
'does not show a flash message'
do
it
'does not show a flash message'
do
...
...
spec/finders/projects_finder_spec.rb
View file @
0e170b0c
...
@@ -195,9 +195,9 @@ RSpec.describe ProjectsFinder do
...
@@ -195,9 +195,9 @@ RSpec.describe ProjectsFinder do
let
(
:current_user
)
{
nil
}
let
(
:current_user
)
{
nil
}
let
(
:params
)
{
{
search:
'C'
}
}
let
(
:params
)
{
{
search:
'C'
}
}
context
'with disable_anonymous_search feature flag enabled'
do
context
'with disable_anonymous_
project_
search feature flag enabled'
do
before
do
before
do
stub_feature_flags
(
disable_anonymous_search:
true
)
stub_feature_flags
(
disable_anonymous_
project_
search:
true
)
end
end
it
'does not perform search'
do
it
'does not perform search'
do
...
@@ -205,9 +205,9 @@ RSpec.describe ProjectsFinder do
...
@@ -205,9 +205,9 @@ RSpec.describe ProjectsFinder do
end
end
end
end
context
'with disable_anonymous_search feature flag disabled'
do
context
'with disable_anonymous_
project_
search feature flag disabled'
do
before
do
before
do
stub_feature_flags
(
disable_anonymous_search:
false
)
stub_feature_flags
(
disable_anonymous_
project_
search:
false
)
end
end
it
'finds one public project'
do
it
'finds one public project'
do
...
...
spec/spec_helper.rb
View file @
0e170b0c
...
@@ -306,8 +306,9 @@ RSpec.configure do |config|
...
@@ -306,8 +306,9 @@ RSpec.configure do |config|
# For more information check https://gitlab.com/gitlab-com/gl-infra/production/-/issues/4321
# For more information check https://gitlab.com/gitlab-com/gl-infra/production/-/issues/4321
stub_feature_flags
(
block_issue_repositioning:
false
)
stub_feature_flags
(
block_issue_repositioning:
false
)
# Th
is is an ops feature flag that's
disabled by default
# Th
ese are ops feature flags that are
disabled by default
stub_feature_flags
(
disable_anonymous_search:
false
)
stub_feature_flags
(
disable_anonymous_search:
false
)
stub_feature_flags
(
disable_anonymous_project_search:
false
)
# Disable the refactored top nav search until there is functionality
# Disable the refactored top nav search until there is functionality
# Can be removed once all existing functionality has been replicated
# Can be removed once all existing functionality has been replicated
...
...
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