Commit 17c12be6 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'fix/nomethod-error-on-ci' into 'master'

Fix error when visiting CI root path

Closes #14528, closes #14687

See merge request !3377
parent 8d5a55ef
......@@ -10,6 +10,7 @@ v 8.6.2
- Fix error with anonymous token in applications settings. !3362
- Fix the milestone 'upcoming' filter. !3364
- Fix comments on confidential issues showing up in activity feed to non-members. !3375
- Fix `NoMethodError` when visiting CI root path at `/ci`. !3377
- Add a tooltip to new branch button in issue page. !3380
- Fix an issue hiding the password form when signed-in with a linked account. !3381
- Add links to CI setup documentation from project settings and builds pages. !3384
......@@ -21,6 +22,7 @@ v 8.6.2
v 8.6.2 (unreleased)
- Comments on confidential issues don't show up in activity feed to non-members
- Fix NoMethodError when visiting CI root path at `/ci`
v 8.6.1
- Add option to reload the schema before restoring a database backup. !2807
......
module Ci
class ProjectsController < Ci::ApplicationController
before_action :project
before_action :authorize_read_project!, except: [:badge]
before_action :no_cache, only: [:badge]
before_action :authorize_read_project!, except: [:badge, :index]
skip_before_action :authenticate_user!, only: [:badge]
protect_from_forgery
def index
redirect_to root_path
end
def show
# Temporary compatibility with CI badges pointing to CI project page
redirect_to namespace_project_path(project.namespace, project)
......@@ -35,5 +39,9 @@ module Ci
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
end
def authorize_read_project!
return access_denied! unless can?(current_user, :read_project, project)
end
end
end
.wiki
%h1
GitLab CI is now integrated in GitLab UI
%h2 For existing projects
%p
Check the following pages to find the CI status you're looking for:
%ul
%li Projects page - shows CI status for each project.
%li Project commits page - show CI status for each commit.
%h2 For new projects
%p
If you want to enable CI for a new project it is easy as adding
= link_to ".gitlab-ci.yml", "http://doc.gitlab.com/ce/ci/yaml/README.html"
file to your repository
......@@ -5,6 +5,27 @@ describe Ci::ProjectsController do
let!(:project) { create(:project, visibility, ci_id: 1) }
let(:ci_id) { project.ci_id }
describe '#index' do
context 'user signed in' do
before do
sign_in(create(:user))
get(:index)
end
it 'redirects to /' do
expect(response).to redirect_to(root_path)
end
end
context 'user not signed in' do
before { get(:index) }
it 'redirects to sign in page' do
expect(response).to redirect_to(new_user_session_path)
end
end
end
##
# Specs for *deprecated* CI badge
#
......
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