Commit 1a424a9b authored by Valery Sizov's avatar Valery Sizov

Explicitly test that guest is able to search through the wiki

parent 7487d06c
......@@ -34,6 +34,12 @@ module SearchHelper
Gitlab::ProjectSearchResults.parse_search_result(result)
end
def show_notes_tab?
[:read_merge_request, :download_code, :read_issue, :read_project_snippet].all? do |ability|
can?(current_user, :read_merge_request, @project)
end
end
private
# Autocomplete results for various settings pages
......
......@@ -27,7 +27,7 @@
Milestones
%span.badge
= @search_results.milestones_count
- if can?(current_user, :read_merge_request, @project) || can?(current_user, :read_issue, @project)
- if show_notes_tab?
%li{ class: active_when(@scope == 'notes') }
= link_to search_filter_path(scope: 'notes') do
Comments
......
......@@ -123,8 +123,8 @@ describe Gitlab::ProjectSearchResults, lib: true do
context 'when wiki is internal' do
let(:project) { create(:project, :public, :wiki_private) }
it 'finds wiki blobs for members' do
project.add_reporter(user)
it 'finds wiki blobs for guest' do
project.add_guest(user)
is_expected.not_to be_empty
end
......
......@@ -29,7 +29,7 @@ describe SearchService, services: true do
it 'returns the project for guests' do
search_project = create :empty_project
search_project.team << [user, :guest]
search_project.add_guest(user)
project = SearchService.new(user, project_id: search_project.id).project
......
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