diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2016-11-08 10:22:55 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2016-11-08 10:22:55 +0000 |
commit | 034e8593374951d6711c9a941643b2da9f6744cf (patch) | |
tree | b62304cf45cffcc0c65e6a8c5f9b769eef63a6c4 | |
parent | 67ca15bb671be304330dd17d15a02c8c3563ce97 (diff) | |
parent | 8357ae980a396cb0aa57ecd182a36c43821b548e (diff) | |
download | gitlab-ce-034e8593374951d6711c9a941643b2da9f6744cf.tar.gz |
Merge branch 'dz-fix-project-index' into 'master'
Fix project index page
See merge request !7331
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | app/controllers/projects_controller.rb | 6 | ||||
-rw-r--r-- | spec/controllers/projects_controller_spec.rb | 20 |
3 files changed, 24 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ed09fb1db8..5b072ce9f60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,7 @@ entry. - Fix applying GitHub-imported labels when importing job is interrupted - Allow to search for user by secondary email address in the admin interface(/admin/users) !7115 (YarNayar) - Updated commit SHA styling on the branches page. +- Fix 404 when visit /projects page ## 8.13.3 (2016-11-02) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 6988527a3be..8cd50480ec1 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -2,9 +2,9 @@ class ProjectsController < Projects::ApplicationController include IssuableCollections include ExtractsPath - before_action :authenticate_user!, except: [:show, :activity, :refs] - before_action :project, except: [:new, :create] - before_action :repository, except: [:new, :create] + before_action :authenticate_user!, except: [:index, :show, :activity, :refs] + before_action :project, except: [:index, :new, :create] + before_action :repository, except: [:index, :new, :create] before_action :assign_ref_vars, only: [:show], if: :repo_exists? before_action :tree, only: [:show], if: [:repo_exists?, :project_view_files?] diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index 8eefa284ba0..a302d1c57f4 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -7,6 +7,26 @@ describe ProjectsController do let(:jpg) { fixture_file_upload(Rails.root + 'spec/fixtures/rails_sample.jpg', 'image/jpg') } let(:txt) { fixture_file_upload(Rails.root + 'spec/fixtures/doc_sample.txt', 'text/plain') } + describe 'GET index' do + context 'as a user' do + it 'redirects to root page' do + sign_in(user) + + get :index + + expect(response).to redirect_to(root_path) + end + end + + context 'as a guest' do + it 'redirects to Explore page' do + get :index + + expect(response).to redirect_to(explore_root_path) + end + end + end + describe "GET show" do context "user not project member" do before { sign_in(user) } |