summaryrefslogtreecommitdiff
path: root/app/controllers/projects_controller.rb
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-06-20 21:50:19 +0200
committerPaco Guzman <pacoguzmanp@gmail.com>2016-06-29 17:56:15 +0200
commit0601ce1871b16d212a938e684f4d9413e62c3f0b (patch)
tree3240dc89a13839edd4e9d05e3311609ef914cb18 /app/controllers/projects_controller.rb
parent79fd3c7b9e152c46b1c600bc645f4da65006242e (diff)
downloadgitlab-ce-0601ce1871b16d212a938e684f4d9413e62c3f0b.tar.gz
Only needed when the project view is ‘Files view’
Diffstat (limited to 'app/controllers/projects_controller.rb')
-rw-r--r--app/controllers/projects_controller.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 2b1f50fd01e..12e0d5a8413 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -4,7 +4,8 @@ class ProjectsController < Projects::ApplicationController
before_action :authenticate_user!, except: [:show, :activity, :refs]
before_action :project, except: [:new, :create]
before_action :repository, except: [:new, :create]
- before_action :assign_ref_vars, :tree, only: [:show], if: :repo_exists?
+ before_action :assign_ref_vars, only: [:show], if: :repo_exists?
+ before_action :tree, only: [:show], if: :project_view_files?
# Authorize
before_action :authorize_admin_project!, only: [:edit, :update, :housekeeping, :download_export, :export, :remove_export, :generate_new_export]
@@ -303,6 +304,10 @@ class ProjectsController < Projects::ApplicationController
project.repository_exists? && !project.empty_repo?
end
+ def project_view_files?
+ current_user && current_user.project_view == 'files'
+ end
+
# Override extract_ref from ExtractsPath, which returns the branch and file path
# for the blob/tree, which in this case is just the root of the default branch.
# This way we avoid to access the repository.ref_names.