Commit 8269317c authored by Stan Hu's avatar Stan Hu

Merge branch 'sd5869/332631/add_project_ids_in_search' into 'master'

Add project_ids to search_controller

See merge request gitlab-org/gitlab!77523
parents 6d3dff70 cabfcc2c
...@@ -143,6 +143,7 @@ class SearchController < ApplicationController ...@@ -143,6 +143,7 @@ class SearchController < ApplicationController
payload[:metadata]['meta.search.filters.confidential'] = params[:confidential] payload[:metadata]['meta.search.filters.confidential'] = params[:confidential]
payload[:metadata]['meta.search.filters.state'] = params[:state] payload[:metadata]['meta.search.filters.state'] = params[:state]
payload[:metadata]['meta.search.force_search_results'] = params[:force_search_results] payload[:metadata]['meta.search.force_search_results'] = params[:force_search_results]
payload[:metadata]['meta.search.project_ids'] = params[:project_ids]
if search_service.abuse_detected? if search_service.abuse_detected?
payload[:metadata]['abuse.confidence'] = Gitlab::Abuse.confidence(:certain) payload[:metadata]['abuse.confidence'] = Gitlab::Abuse.confidence(:certain)
......
...@@ -396,9 +396,10 @@ RSpec.describe SearchController do ...@@ -396,9 +396,10 @@ RSpec.describe SearchController do
expect(payload[:metadata]['meta.search.force_search_results']).to eq('true') expect(payload[:metadata]['meta.search.force_search_results']).to eq('true')
expect(payload[:metadata]['meta.search.filters.confidential']).to eq('true') expect(payload[:metadata]['meta.search.filters.confidential']).to eq('true')
expect(payload[:metadata]['meta.search.filters.state']).to eq('true') expect(payload[:metadata]['meta.search.filters.state']).to eq('true')
expect(payload[:metadata]['meta.search.project_ids']).to eq(%w(456 789))
end end
get :show, params: { scope: 'issues', search: 'hello world', group_id: '123', project_id: '456', confidential: true, state: true, force_search_results: true } get :show, params: { scope: 'issues', search: 'hello world', group_id: '123', project_id: '456', project_ids: %w(456 789), confidential: true, state: true, force_search_results: true }
end end
it 'appends the default scope in meta.search.scope' do it 'appends the default scope in meta.search.scope' do
......
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