summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-11-15 10:19:51 +0000
committerDouwe Maan <douwe@gitlab.com>2016-11-15 10:19:51 +0000
commite98e7c60c5ff115f1d892a82722e0951e049e301 (patch)
tree65664b36c19344229fb4f2651cafde8879c2645a
parent05692e0bfab58ddc4082394c711b50b27d89f4b6 (diff)
parent50f047cadd6db4bc6e9f08beefbdf48f35ef876c (diff)
downloadgitlab-ce-e98e7c60c5ff115f1d892a82722e0951e049e301.tar.gz
Merge branch '24392-lfs-helper-refactor' into 'master'
Move the `objects` method to `LfsHelper` so that it is also available to `LfsStorageController` ## What does this MR do? Move the `objects` method to `LfsHelper` so that it is also available to `LfsStorageController` It is needed for the `lfs_check_access!` callback when the repository size limit is enabled (EE only). cc @stanhu @ahanselka ## Why was this MR needed? Errors shown here: gitlab-org/gitlab-ce#24392 Discovered thanks to gitlab-com/infrastructure#302 ## What are the relevant issue numbers? Fixes #24392 Fixes gitlab-com/support-forum#1280 See merge request !7417
-rw-r--r--app/controllers/projects/lfs_api_controller.rb4
-rw-r--r--app/helpers/lfs_helper.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/app/controllers/projects/lfs_api_controller.rb b/app/controllers/projects/lfs_api_controller.rb
index ece49dcd922..2d493276941 100644
--- a/app/controllers/projects/lfs_api_controller.rb
+++ b/app/controllers/projects/lfs_api_controller.rb
@@ -31,10 +31,6 @@ class Projects::LfsApiController < Projects::GitHttpClientController
private
- def objects
- @objects ||= (params[:objects] || []).to_a
- end
-
def existing_oids
@existing_oids ||= begin
storage_project.lfs_objects.where(oid: objects.map { |o| o['oid'].to_s }).pluck(:oid)
diff --git a/app/helpers/lfs_helper.rb b/app/helpers/lfs_helper.rb
index d3966ba1f10..2425c3a8bc8 100644
--- a/app/helpers/lfs_helper.rb
+++ b/app/helpers/lfs_helper.rb
@@ -30,6 +30,10 @@ module LfsHelper
ci? || lfs_deploy_token? || user_can_download_code? || build_can_download_code?
end
+ def objects
+ @objects ||= (params[:objects] || []).to_a
+ end
+
def user_can_download_code?
has_authentication_ability?(:download_code) && can?(user, :download_code, project)
end