summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-04-06 17:52:15 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-04-10 21:28:41 +0300
commite585b77730b2a38173453bb5e437628fe6eb9844 (patch)
treedc17cbc02181b3fe8d987ba79226d05a4d4d650c /app/controllers
parent0b5a8a34e0b7851957b976a8151a7d6acf8b9f69 (diff)
downloadgitlab-ce-e585b77730b2a38173453bb5e437628fe6eb9844.tar.gz
Change project view default for existing users and anonymous visitors to files+readmedz-fix-project-view
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects_controller.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 47f7e0b1b28..6807c37f972 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -345,7 +345,11 @@ class ProjectsController < Projects::ApplicationController
end
def project_view_files?
- current_user && current_user.project_view == 'files'
+ if current_user
+ current_user.project_view == 'files'
+ else
+ project_view_files_allowed?
+ end
end
# Override extract_ref from ExtractsPath, which returns the branch and file path
@@ -359,4 +363,8 @@ class ProjectsController < Projects::ApplicationController
def get_id
project.repository.root_ref
end
+
+ def project_view_files_allowed?
+ !project.empty_repo? && can?(current_user, :download_code, project)
+ end
end