Skip to content
Snippets Groups Projects
Commit 1a424a9b authored by Valery Sizov's avatar Valery Sizov
Browse files

Explicitly test that guest is able to search through the wiki

parent 7487d06c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -33,6 +33,12 @@ module SearchHelper
def parse_search_result(result)
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
 
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment