Commit b03b3165 authored by Micaël Bergeron's avatar Micaël Bergeron

fixing some broken merges

parent 4484587e
class Projects::JobsController < Projects::ApplicationController class Projects::JobsController < Projects::ApplicationController
include SendFileUpload
before_action :build, except: [:index, :cancel_all] before_action :build, except: [:index, :cancel_all]
before_action :authorize_read_build!, before_action :authorize_read_build!,
......
...@@ -71,10 +71,7 @@ class Projects::LfsStorageController < Projects::GitHttpClientController ...@@ -71,10 +71,7 @@ class Projects::LfsStorageController < Projects::GitHttpClientController
end end
def move_tmp_file_to_storage(object, path) def move_tmp_file_to_storage(object, path)
File.open(path) do |f| object.file = File.open(path)
object.file = f
end
object.file.store! object.file.store!
object.save object.save
end end
......
...@@ -9,16 +9,8 @@ class LfsObject < ActiveRecord::Base ...@@ -9,16 +9,8 @@ class LfsObject < ActiveRecord::Base
validates :oid, presence: true, uniqueness: true validates :oid, presence: true, uniqueness: true
scope :with_files_stored_locally, -> { where(file_store: [nil, LfsObjectUploader::Store::LOCAL]) }
mount_uploader :file, LfsObjectUploader 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) def project_allowed_access?(project)
projects.exists?(project.lfs_storage_project.id) projects.exists?(project.lfs_storage_project.id)
end end
......
...@@ -2,6 +2,7 @@ class AttachmentUploader < GitlabUploader ...@@ -2,6 +2,7 @@ class AttachmentUploader < GitlabUploader
include RecordsUploads::Concern include RecordsUploads::Concern
include ObjectStorage::Concern include ObjectStorage::Concern
prepend ObjectStorage::Extension::RecordsUploads prepend ObjectStorage::Extension::RecordsUploads
include UploaderHelper
private private
......
...@@ -89,29 +89,6 @@ describe FileUploader do ...@@ -89,29 +89,6 @@ describe FileUploader do
end end
end end
describe 'callbacks' do
describe '#prune_store_dir after :remove' do
before do
uploader.store!(fixture_file_upload('spec/fixtures/doc_sample.txt'))
end
def store_dir
File.expand_path(uploader.store_dir, uploader.root)
end
it 'is called' do
expect(uploader).to receive(:prune_store_dir).once
uploader.remove!
end
it 'prune the store directory' do
expect { uploader.remove! }
.to change { File.exist?(store_dir) }.from(true).to(false)
end
end
end
describe "#migrate!" do describe "#migrate!" do
before do before do
uploader.store!(fixture_file_upload(Rails.root.join('spec/fixtures/dk.png'))) uploader.store!(fixture_file_upload(Rails.root.join('spec/fixtures/dk.png')))
...@@ -137,8 +114,5 @@ describe FileUploader do ...@@ -137,8 +114,5 @@ describe FileUploader do
uploader.upload = upload uploader.upload = upload
end end
it_behaves_like "migrates", to_store: described_class::Store::REMOTE
it_behaves_like "migrates", from_store: described_class::Store::REMOTE, to_store: described_class::Store::LOCAL
end end
end end
...@@ -20,7 +20,7 @@ describe ObjectStorageUploadWorker do ...@@ -20,7 +20,7 @@ describe ObjectStorageUploadWorker do
stub_lfs_object_storage(background_upload: true) stub_lfs_object_storage(background_upload: true)
end end
it 'uploads object to storage' d it 'uploads object to storage' do
expect { perform }.to change { lfs_object.reload.file_store }.from(local).to(remote) expect { perform }.to change { lfs_object.reload.file_store }.from(local).to(remote)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment