Commit c4e451fe authored by Terri Chu's avatar Terri Chu Committed by Dylan Griffith

[Feature flag] Rollout of `search_filter_by_confidential`

parent a53ff11f
.d-lg-flex.align-items-end .d-lg-flex.align-items-end
#js-search-filter-by-state{ 'v-cloak': true } #js-search-filter-by-state{ 'v-cloak': true }
- if Feature.enabled?(:search_filter_by_confidential, @group)
#js-search-filter-by-confidential{ 'v-cloak': true } #js-search-filter-by-confidential{ 'v-cloak': true }
- if %w(issues merge_requests).include?(@scope) - if %w(issues merge_requests).include?(@scope)
......
---
title: Remove search_filter_by_confidential Feature Flag
merge_request: 45819
author:
type: changed
---
name: search_filter_by_confidential
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40793
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/244923
group: group::global search
type: development
default_enabled: false
\ No newline at end of file
...@@ -7,7 +7,8 @@ type: reference, api ...@@ -7,7 +7,8 @@ type: reference, api
# Search API # Search API
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/41763) in GitLab 10.5. > - [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/41763) in GitLab 10.5.
> - [Feature flag `search_filter_by_confidential` removed](https://gitlab.com/gitlab-org/gitlab/-/issues/244923) in GitLab 13.6.
Every API call to search must be authenticated. Every API call to search must be authenticated.
...@@ -24,7 +25,7 @@ GET /search ...@@ -24,7 +25,7 @@ GET /search
| `scope` | string | yes | The scope to search in | | `scope` | string | yes | The scope to search in |
| `search` | string | yes | The search query | | `search` | string | yes | The search query |
| `state` | string | no | Filter by state. Issues and merge requests are supported; it is ignored for other scopes. | | `state` | string | no | Filter by state. Issues and merge requests are supported; it is ignored for other scopes. |
| `confidential` | boolean | no | Filter by confidentiality. Issues scope is supported; it is ignored for other scopes. This parameter is behind a [feature flag (`search_filter_by_confidential`)](../administration/feature_flags.md). | | `confidential` | boolean | no | Filter by confidentiality. Issues scope is supported; it is ignored for other scopes. |
Search the expression within the specified scope. Currently these scopes are supported: projects, issues, merge_requests, milestones, snippet_titles, users. Search the expression within the specified scope. Currently these scopes are supported: projects, issues, merge_requests, milestones, snippet_titles, users.
...@@ -434,7 +435,7 @@ GET /groups/:id/search ...@@ -434,7 +435,7 @@ GET /groups/:id/search
| `scope` | string | yes | The scope to search in | | `scope` | string | yes | The scope to search in |
| `search` | string | yes | The search query | | `search` | string | yes | The search query |
| `state` | string | no | Filter by state. Issues and merge requests are supported; it is ignored for other scopes. | | `state` | string | no | Filter by state. Issues and merge requests are supported; it is ignored for other scopes. |
| `confidential` | boolean | no | Filter by confidentiality. Issues scope is supported; it is ignored for other scopes. This parameter is behind a [feature flag (`search_filter_by_confidential`)](../administration/feature_flags.md). | | `confidential` | boolean | no | Filter by confidentiality. Issues scope is supported; it is ignored for other scopes. |
Search the expression within the specified scope. Currently these scopes are supported: projects, issues, merge_requests, milestones, users. Search the expression within the specified scope. Currently these scopes are supported: projects, issues, merge_requests, milestones, users.
...@@ -814,7 +815,7 @@ GET /projects/:id/search ...@@ -814,7 +815,7 @@ GET /projects/:id/search
| `search` | string | yes | The search query | | `search` | string | yes | The search query |
| `ref` | string | no | The name of a repository branch or tag to search on. The project's default branch is used by default. This is only applicable for scopes: commits, blobs, and wiki_blobs. | | `ref` | string | no | The name of a repository branch or tag to search on. The project's default branch is used by default. This is only applicable for scopes: commits, blobs, and wiki_blobs. |
| `state` | string | no | Filter by state. Issues and merge requests are supported; it is ignored for other scopes. | | `state` | string | no | Filter by state. Issues and merge requests are supported; it is ignored for other scopes. |
| `confidential` | boolean | no | Filter by confidentiality. Issues scope is supported; it is ignored for other scopes. This parameter is behind a [feature flag (`search_filter_by_confidential`)](../administration/feature_flags.md). | | `confidential` | boolean | no | Filter by confidentiality. Issues scope is supported; it is ignored for other scopes. |
Search the expression within the specified scope. Currently these scopes are supported: issues, merge_requests, milestones, notes, wiki_blobs, commits, blobs, users. Search the expression within the specified scope. Currently these scopes are supported: issues, merge_requests, milestones, notes, wiki_blobs, commits, blobs, users.
......
...@@ -37,7 +37,7 @@ module Elastic ...@@ -37,7 +37,7 @@ module Elastic
current_user = options[:current_user] current_user = options[:current_user]
project_ids = options[:project_ids] project_ids = options[:project_ids]
if [true, false].include?(options[:confidential]) && Feature.enabled?(:search_filter_by_confidential) if [true, false].include?(options[:confidential])
query_hash[:query][:bool][:filter] << { term: { confidential: options[:confidential] } } query_hash[:query][:bool][:filter] << { term: { confidential: options[:confidential] } }
end end
......
...@@ -219,7 +219,7 @@ module Gitlab ...@@ -219,7 +219,7 @@ module Gitlab
params[:state] = filters[:state] if filters.key?(:state) params[:state] = filters[:state] if filters.key?(:state)
if [true, false].include?(filters[:confidential]) && Feature.enabled?(:search_filter_by_confidential) if [true, false].include?(filters[:confidential])
params[:confidential] = filters[:confidential] params[:confidential] = filters[:confidential]
end end
end end
......
...@@ -151,7 +151,6 @@ RSpec.describe API::Search do ...@@ -151,7 +151,6 @@ RSpec.describe API::Search do
context 'filter by confidentiality' do context 'filter by confidentiality' do
before do before do
stub_feature_flags(search_filter_by_confidential: true)
create(:issue, project: project, author: user, title: 'awesome non-confidential issue') create(:issue, project: project, author: user, title: 'awesome non-confidential issue')
create(:issue, :confidential, project: project, author: user, title: 'awesome confidential issue') create(:issue, :confidential, project: project, author: user, title: 'awesome confidential issue')
end end
......
...@@ -4,66 +4,27 @@ RSpec.shared_examples 'search results filtered by confidential' do ...@@ -4,66 +4,27 @@ RSpec.shared_examples 'search results filtered by confidential' do
context 'filter not provided (all behavior)' do context 'filter not provided (all behavior)' do
let(:filters) { {} } let(:filters) { {} }
context 'when Feature search_filter_by_confidential enabled' do
it 'returns confidential and not confidential results', :aggregate_failures do it 'returns confidential and not confidential results', :aggregate_failures do
expect(results.objects('issues')).to include confidential_result expect(results.objects('issues')).to include confidential_result
expect(results.objects('issues')).to include opened_result expect(results.objects('issues')).to include opened_result
end end
end end
context 'when Feature search_filter_by_confidential not enabled' do
before do
stub_feature_flags(search_filter_by_confidential: false)
end
it 'returns confidential and not confidential results', :aggregate_failures do
expect(results.objects('issues')).to include confidential_result
expect(results.objects('issues')).to include opened_result
end
end
end
context 'confidential filter' do context 'confidential filter' do
let(:filters) { { confidential: true } } let(:filters) { { confidential: true } }
context 'when Feature search_filter_by_confidential enabled' do
it 'returns only confidential results', :aggregate_failures do it 'returns only confidential results', :aggregate_failures do
expect(results.objects('issues')).to include confidential_result expect(results.objects('issues')).to include confidential_result
expect(results.objects('issues')).not_to include opened_result expect(results.objects('issues')).not_to include opened_result
end end
end end
context 'when Feature search_filter_by_confidential not enabled' do
before do
stub_feature_flags(search_filter_by_confidential: false)
end
it 'returns confidential and not confidential results', :aggregate_failures do
expect(results.objects('issues')).to include confidential_result
expect(results.objects('issues')).to include opened_result
end
end
end
context 'not confidential filter' do context 'not confidential filter' do
let(:filters) { { confidential: false } } let(:filters) { { confidential: false } }
context 'when Feature search_filter_by_confidential enabled' do
it 'returns not confidential results', :aggregate_failures do it 'returns not confidential results', :aggregate_failures do
expect(results.objects('issues')).not_to include confidential_result expect(results.objects('issues')).not_to include confidential_result
expect(results.objects('issues')).to include opened_result expect(results.objects('issues')).to include opened_result
end end
end end
context 'when Feature search_filter_by_confidential not enabled' do
before do
stub_feature_flags(search_filter_by_confidential: false)
end
it 'returns confidential and not confidential results', :aggregate_failures do
expect(results.objects('issues')).to include confidential_result
expect(results.objects('issues')).to include opened_result
end
end
end
end end
...@@ -61,20 +61,6 @@ RSpec.describe 'search/_results' do ...@@ -61,20 +61,6 @@ RSpec.describe 'search/_results' do
expect(rendered).to have_selector('#js-search-filter-by-state') expect(rendered).to have_selector('#js-search-filter-by-state')
end end
context 'Feature search_filter_by_confidential' do
context 'when disabled' do
before do
stub_feature_flags(search_filter_by_confidential: false)
end
it 'does not render the confidential drop down' do
render
expect(rendered).not_to have_selector('#js-search-filter-by-confidential')
end
end
context 'when enabled' do
it 'renders the confidential drop down' do it 'renders the confidential drop down' do
render render
...@@ -83,6 +69,4 @@ RSpec.describe 'search/_results' do ...@@ -83,6 +69,4 @@ RSpec.describe 'search/_results' do
end end
end end
end end
end
end
end end
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