Commit 6aa50165 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'logged-out-search' into 'master'

Logged out search

Fixes #13676  

See merge request !3045
parents b8f8a55b 4c8721b2
......@@ -8,6 +8,7 @@ v 8.6.0 (unreleased)
- Strip leading and trailing spaces in URL validator (evuez)
- Return empty array instead of 404 when commit has no statuses in commit status API
- Update documentation to reflect Guest role not being enforced on internal projects
- Allow search for logged out users
v 8.5.2
- Fix sidebar overlapping content when screen width was below 1200px
......
......@@ -305,7 +305,7 @@ table {
}
.btn-sign-in {
margin-top: 8px;
margin-top: 10px;
text-shadow: none;
}
......
.search-results {
.search-result-row {
border-bottom: 1px solid #DDD;
padding-bottom: 15px;
margin-bottom: 15px;
border-bottom: 1px solid $border-color;
padding-bottom: $gl-padding;
margin-bottom: $gl-padding;
&:last-child {
border-bottom: none;
}
}
}
......
class SearchController < ApplicationController
skip_before_action :authenticate_user!, :reject_blocked
include SearchHelper
layout 'search'
......
......@@ -5,11 +5,7 @@
-# Ideally this would be inside the head, but turbolinks only evaluates page-specific JS in the body.
= yield :scripts_body_top
- if current_user
= render "layouts/header/default", title: header_title
- else
= render "layouts/header/public", title: header_title
= render 'layouts/page', sidebar: sidebar
= yield :scripts_body
......@@ -13,6 +13,7 @@
%li.visible-sm.visible-xs
= link_to search_path, title: 'Search', data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
= icon('search')
- if current_user
- if session[:impersonator_id]
%li.impersonation
= link_to stop_impersonation_admin_users_path, method: :delete, title: 'Stop Impersonation', data: { toggle: 'tooltip', placement: 'bottom', container: 'body' } do
......@@ -37,6 +38,10 @@
%li
= link_to destroy_user_session_path, class: 'logout', method: :delete, title: 'Sign out', data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
= icon('sign-out')
- else
.pull-right
= link_to "Sign in", new_session_path(:user, redirect_to_referer: 'yes'), class: 'btn btn-sign-in btn-success'
%h1.title= title
......
%header.navbar.navbar-fixed-top.navbar-gitlab{ class: nav_header_class }
%div{ class: fluid_layout ? "container-fluid" : "container-fluid" }
.header-content
- unless current_controller?('sessions')
.pull-right
= link_to "Sign in", new_session_path(:user, redirect_to_referer: 'yes'), class: 'btn btn-sign-in btn-success'
%h1.title= title
= render 'shared/outdated_browser'
......@@ -11,4 +11,4 @@
= button_tag 'Search', class: "btn btn-primary"
- unless params[:snippets].eql? 'true'
%br
= render 'filter'
= render 'filter' if current_user
......@@ -65,3 +65,25 @@ Feature: Search
And I search for "Wiki content"
And I click "Wiki" link
Then I should see "test_wiki" link in the search results
Scenario: I logout and should see project I am looking for
Given project "Shop" is public
And I logout
And I search for "Sho"
Then I should see "Shop" project link
Scenario: I logout and should see issues I am looking for
Given project "Shop" is public
And I logout
And project has issues
When I search for "Foo"
And I click "Issues" link
Then I should see "Foo" link in the search results
And I should not see "Bar" link in the search results
Scenario: I logout and should see project code I am looking for
Given project "Shop" is public
And I logout
When I visit project "Shop" page
And I search for "rspec" on project page
Then I should see code results for project "Shop"
......@@ -18,6 +18,11 @@ class Spinach::Features::Search < Spinach::FeatureSteps
click_button "Search"
end
step 'I search for "rspec" on project page' do
fill_in "search", with: "rspec"
click_button "Go"
end
step 'I search for "Wiki content"' do
fill_in "dashboard_search", with: "content"
click_button "Search"
......@@ -103,4 +108,8 @@ class Spinach::Features::Search < Spinach::FeatureSteps
@wiki = ::ProjectWiki.new(project, current_user)
@wiki.create_page("test_wiki", "Some Wiki content", :markdown, "first commit")
end
step 'project "Shop" is public' do
project.update_attributes(visibility_level: Project::PUBLIC)
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