Commit a93a1994 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'jl-isolate-anonymous-projects-search' into 'master'

Isolate disable anonymous project search to its own FF

See merge request gitlab-org/gitlab!70436
parents 42ae24d2 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
......
...@@ -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?)
......
---
name: disable_anonymous_project_search
introduced_by_url:
rollout_issue_url:
milestone: '14.3'
type: ops
group: group::project management
default_enabled: false
...@@ -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
......
...@@ -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
......
...@@ -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)
# This is an ops feature flag that's disabled by default # These 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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment