Commit 122acb22 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

fix unauth for public

parent 4c6224aa
...@@ -6,6 +6,6 @@ class Public::ProjectsController < ApplicationController ...@@ -6,6 +6,6 @@ class Public::ProjectsController < ApplicationController
layout 'public' layout 'public'
def index def index
@projects = Project.where(public: true) @projects = Project.public
end end
end end
...@@ -81,6 +81,7 @@ class Project < ActiveRecord::Base ...@@ -81,6 +81,7 @@ class Project < ActiveRecord::Base
scope :sorted_by_activity, ->() { order("(SELECT max(events.created_at) FROM events WHERE events.project_id = projects.id) DESC") } scope :sorted_by_activity, ->() { order("(SELECT max(events.created_at) FROM events WHERE events.project_id = projects.id) DESC") }
scope :personal, ->(user) { where(namespace_id: user.namespace_id) } scope :personal, ->(user) { where(namespace_id: user.namespace_id) }
scope :joined, ->(user) { where("namespace_id != ?", user.namespace_id) } scope :joined, ->(user) { where("namespace_id != ?", user.namespace_id) }
scope :public, where(public: true)
class << self class << self
def active def active
......
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
= favicon_link_tag 'favicon.ico' = favicon_link_tag 'favicon.ico'
= stylesheet_link_tag "application" = stylesheet_link_tag "application"
= javascript_include_tag "application" = javascript_include_tag "application"
= csrf_meta_tags
-# Atom feed -# Atom feed
- if current_user
- if controller_name == 'projects' && action_name == 'index' - if controller_name == 'projects' && action_name == 'index'
= auto_discovery_link_tag :atom, projects_url(:atom, private_token: current_user.private_token), title: "Dashboard feed" = auto_discovery_link_tag :atom, projects_url(:atom, private_token: current_user.private_token), title: "Dashboard feed"
- if @project && !@project.new_record? - if @project && !@project.new_record?
...@@ -14,4 +17,3 @@ ...@@ -14,4 +17,3 @@
= auto_discovery_link_tag(:atom, project_commits_url(@project, @ref, format: :atom, private_token: current_user.private_token), title: "Recent commits to #{@project.name}:#{@ref}") = auto_discovery_link_tag(:atom, project_commits_url(@project, @ref, format: :atom, private_token: current_user.private_token), title: "Recent commits to #{@project.name}:#{@ref}")
- if current_controller?(:issues) - if current_controller?(:issues)
= auto_discovery_link_tag(:atom, project_issues_url(@project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues") = auto_discovery_link_tag(:atom, project_issues_url(@project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues")
= csrf_meta_tags
!!! 5 !!! 5
%html{ lang: "en"} %html{ lang: "en"}
= render "layouts/head", title: "Error" = render "layouts/head", title: "Public Area"
%body{class: "#{app_theme} application"} %body{class: "#{app_theme} application"}
%header.navbar.navbar-static-top.navbar-gitlab %header.navbar.navbar-static-top.navbar-gitlab
.navbar-inner .navbar-inner
.container .container
%div.app_logo %div.app_logo
%span.separator %span.separator
= link_to public_root_path, class: "home" do = link_to root_path, class: "home" do
%h1 GITLAB %h1 GITLAB
%span.separator %span.separator
%h1.project_name Public %h1.project_name Public Area
.container .container
.content .content
.prepend-top-20 .prepend-top-20
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
%small Read-Only Access %small Read-Only Access
%hr %hr
%ul.well-list %ul.unstyled
- @projects.each do |project| - @projects.each do |project|
%li.clearfix %li.clearfix
%h5 %h5
......
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