From b03b31659b0101dc4a5838bec7dca193706661cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mica=C3=ABl=20Bergeron?= Date: Fri, 2 Mar 2018 16:19:17 -0500 Subject: fixing some broken merges --- app/controllers/projects/jobs_controller.rb | 2 ++ app/controllers/projects/lfs_storage_controller.rb | 5 +---- app/models/lfs_object.rb | 8 -------- app/uploaders/attachment_uploader.rb | 1 + 4 files changed, 4 insertions(+), 12 deletions(-) (limited to 'app') diff --git a/app/controllers/projects/jobs_controller.rb b/app/controllers/projects/jobs_controller.rb index abf4be6250b..85e972d9731 100644 --- a/app/controllers/projects/jobs_controller.rb +++ b/app/controllers/projects/jobs_controller.rb @@ -1,4 +1,6 @@ class Projects::JobsController < Projects::ApplicationController + include SendFileUpload + before_action :build, except: [:index, :cancel_all] before_action :authorize_read_build!, diff --git a/app/controllers/projects/lfs_storage_controller.rb b/app/controllers/projects/lfs_storage_controller.rb index 88fc373945a..6b16f1ccbbb 100644 --- a/app/controllers/projects/lfs_storage_controller.rb +++ b/app/controllers/projects/lfs_storage_controller.rb @@ -71,10 +71,7 @@ class Projects::LfsStorageController < Projects::GitHttpClientController end def move_tmp_file_to_storage(object, path) - File.open(path) do |f| - object.file = f - end - + object.file = File.open(path) object.file.store! object.save end diff --git a/app/models/lfs_object.rb b/app/models/lfs_object.rb index 54840fb084d..6c78c086662 100644 --- a/app/models/lfs_object.rb +++ b/app/models/lfs_object.rb @@ -9,16 +9,8 @@ class LfsObject < ActiveRecord::Base validates :oid, presence: true, uniqueness: true - scope :with_files_stored_locally, -> { where(file_store: [nil, LfsObjectUploader::Store::LOCAL]) } - mount_uploader :file, LfsObjectUploader - after_save if: :file_changed?, on: [:create, :update] do - run_after_commit do - file.schedule_background_upload - end - end - def project_allowed_access?(project) projects.exists?(project.lfs_storage_project.id) end diff --git a/app/uploaders/attachment_uploader.rb b/app/uploaders/attachment_uploader.rb index 11e038f9327..cd819dc9bff 100644 --- a/app/uploaders/attachment_uploader.rb +++ b/app/uploaders/attachment_uploader.rb @@ -2,6 +2,7 @@ class AttachmentUploader < GitlabUploader include RecordsUploads::Concern include ObjectStorage::Concern prepend ObjectStorage::Extension::RecordsUploads + include UploaderHelper private -- cgit v1.2.1