Commit e915ee33 authored by David Palubin's avatar David Palubin Committed by Mayra Cabrera

Prevent archived projects from showing up in global search

parent ae69bdea
...@@ -18,7 +18,7 @@ module Search ...@@ -18,7 +18,7 @@ module Search
end end
def projects def projects
@projects ||= ProjectsFinder.new(current_user: current_user).execute @projects ||= ProjectsFinder.new(params: { non_archived: true }, current_user: current_user).execute
end end
def allowed_scopes def allowed_scopes
......
---
title: Prevent archived projects from showing up in global search
merge_request: 31498
author: David Palubin
type: fixed
...@@ -42,6 +42,14 @@ describe Search::GlobalService do ...@@ -42,6 +42,14 @@ describe Search::GlobalService do
expect(results.objects('projects')).to match_array [found_project] expect(results.objects('projects')).to match_array [found_project]
end end
it 'does not return archived projects' do
archived_project = create(:project, :public, archived: true, name: 'archived_project')
results = described_class.new(user, search: "archived").execute
expect(results.objects('projects')).not_to include(archived_project)
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