Commit dbcf6f37 authored by Stan Hu's avatar Stan Hu

Merge branch '244868-add-search-filters-to-metadata' into 'master'

Add new search params to metadata

See merge request gitlab-org/gitlab!45896
parents b394c292 55773436
...@@ -139,6 +139,9 @@ class SearchController < ApplicationController ...@@ -139,6 +139,9 @@ class SearchController < ApplicationController
payload[:metadata]['meta.search.project_id'] = params[:project_id] payload[:metadata]['meta.search.project_id'] = params[:project_id]
payload[:metadata]['meta.search.search'] = params[:search] payload[:metadata]['meta.search.search'] = params[:search]
payload[:metadata]['meta.search.scope'] = params[:scope] payload[:metadata]['meta.search.scope'] = params[:scope]
payload[:metadata]['meta.search.filters.confidential'] = params[:confidential]
payload[:metadata]['meta.search.filters.state'] = params[:state]
payload[:metadata]['meta.search.force_search_results'] = params[:force_search_results]
end end
def block_anonymous_global_searches def block_anonymous_global_searches
......
---
title: Add new search params to metadata
merge_request: 45896
author:
type: changed
...@@ -268,12 +268,15 @@ RSpec.describe SearchController do ...@@ -268,12 +268,15 @@ RSpec.describe SearchController do
last_payload = payload last_payload = payload
end end
get :show, params: { scope: 'issues', search: 'hello world', group_id: '123', project_id: '456' } get :show, params: { scope: 'issues', search: 'hello world', group_id: '123', project_id: '456', confidential: true, state: true, force_search_results: true }
expect(last_payload[:metadata]['meta.search.group_id']).to eq('123') expect(last_payload[:metadata]['meta.search.group_id']).to eq('123')
expect(last_payload[:metadata]['meta.search.project_id']).to eq('456') expect(last_payload[:metadata]['meta.search.project_id']).to eq('456')
expect(last_payload[:metadata]['meta.search.search']).to eq('hello world') expect(last_payload[:metadata]['meta.search.search']).to eq('hello world')
expect(last_payload[:metadata]['meta.search.scope']).to eq('issues') expect(last_payload[:metadata]['meta.search.scope']).to eq('issues')
expect(last_payload[:metadata]['meta.search.force_search_results']).to eq('true')
expect(last_payload[:metadata]['meta.search.filters.confidential']).to eq('true')
expect(last_payload[:metadata]['meta.search.filters.state']).to eq('true')
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