Commit 28a53e89 authored by Sean McGivern's avatar Sean McGivern

Merge branch '5307-fix-personal-snippets-background-upload' into 'master'

Resolve "Snippets uploads fails when background upload is enabled"

Closes #5307

See merge request gitlab-org/gitlab-ee!5049
parents 4931f67a f321d45b
...@@ -72,12 +72,6 @@ class Projects::LfsStorageController < Projects::GitHttpClientController ...@@ -72,12 +72,6 @@ class Projects::LfsStorageController < Projects::GitHttpClientController
end end
end end
def move_tmp_file_to_storage(object, path)
object.file = File.open(path)
object.file.store!
object.save
end
def link_to_project!(object) def link_to_project!(object)
if object && !object.projects.exists?(storage_project.id) if object && !object.projects.exists?(storage_project.id)
object.projects << storage_project object.projects << storage_project
......
...@@ -10,7 +10,11 @@ class FileMover ...@@ -10,7 +10,11 @@ class FileMover
def execute def execute
move move
uploader.record_upload if update_markdown
if update_markdown
uploader.record_upload
uploader.schedule_background_upload
end
end end
private private
......
...@@ -55,6 +55,7 @@ module ObjectStorage ...@@ -55,6 +55,7 @@ module ObjectStorage
def schedule_background_upload(*args) def schedule_background_upload(*args)
return unless schedule_background_upload? return unless schedule_background_upload?
return unless upload
ObjectStorage::BackgroundMoveWorker.perform_async(self.class.name, ObjectStorage::BackgroundMoveWorker.perform_async(self.class.name,
upload.class.to_s, upload.class.to_s,
......
---
title: Fixed personal snippets uploads when background upload is enabled.
merge_request: 5049
author:
type: fixed
...@@ -36,6 +36,12 @@ describe FileMover do ...@@ -36,6 +36,12 @@ describe FileMover do
it 'creates a new update record' do it 'creates a new update record' do
expect { subject }.to change { Upload.count }.by(1) expect { subject }.to change { Upload.count }.by(1)
end end
it 'schedules a background migration' do
expect_any_instance_of(PersonalFileUploader).to receive(:schedule_background_upload).once
subject
end
end end
context 'when update_markdown fails' do context 'when update_markdown fails' do
......
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