Commit 9d73045f authored by Luke Duncalfe's avatar Luke Duncalfe

Merge branch 'john-mason-search-archived-code' into 'master'

Fallback to basic project search for archived projects

See merge request gitlab-org/gitlab!82517
parents cc77129a 5ba09f80
...@@ -10,6 +10,7 @@ module EE ...@@ -10,6 +10,7 @@ module EE
override :execute override :execute
def execute def execute
return super if project.respond_to?(:archived?) && project.archived?
return super unless use_elasticsearch? && use_default_branch? return super unless use_elasticsearch? && use_default_branch?
if project.is_a?(Array) if project.is_a?(Array)
......
...@@ -18,6 +18,28 @@ RSpec.describe Search::ProjectService do ...@@ -18,6 +18,28 @@ RSpec.describe Search::ProjectService do
let(:user) { scope.first_owner } let(:user) { scope.first_owner }
let(:service) { described_class.new(scope, user, params) } let(:service) { described_class.new(scope, user, params) }
end end
context 'and project is archived' do
it 'uses basic project search' do
project = instance_double(Project, archived?: true)
user = instance_double(User)
search_results = instance_double(Gitlab::ProjectSearchResults)
params = { search: "foo" }
search_service = described_class.new(project, user, params)
expect(Gitlab::ProjectSearchResults).to receive(:new).with(
user,
params[:search],
project: project,
repository_ref: params[:repository_ref],
order_by: params[:order_by],
sort: params[:sort],
filters: { confidential: params[:confidential], state: params[:state] }
).and_return search_results
expect(search_service.execute).to eq(search_results)
end
end
end end
context 'when a multiple projects provided' do context 'when a multiple projects provided' 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