summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2018-07-16 11:45:11 +0200
committerJames Lopez <james@jameslopez.es>2018-07-16 11:45:11 +0200
commit97ce0607d57d9a03fc6348a7ce3f9b069ced6c90 (patch)
tree9b0053422e97efaaffaa8e642549cb16375a4654
parent07ec2c7bd00e6d0487e3f81864af982ec73365b2 (diff)
downloadgitlab-ce-97ce0607d57d9a03fc6348a7ce3f9b069ced6c90.tar.gz
refactor code based on feedback
-rw-r--r--lib/gitlab/import_export/uploads_manager.rb8
-rw-r--r--lib/gitlab/import_export/uploads_restorer.rb2
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/gitlab/import_export/uploads_manager.rb b/lib/gitlab/import_export/uploads_manager.rb
index db7c5e881c7..1110149712d 100644
--- a/lib/gitlab/import_export/uploads_manager.rb
+++ b/lib/gitlab/import_export/uploads_manager.rb
@@ -51,7 +51,7 @@ module Gitlab
def copy_from_object_storage
return unless Gitlab::ImportExport.object_storage?
- uploaders do |uploader|
+ each_uploader do |uploader|
next unless uploader.file
next if uploader.upload.local? # Already copied, using the old method
@@ -67,19 +67,19 @@ module Gitlab
@uploads_export_path ||= File.join(@shared.export_path, @relative_export_path)
end
- def uploaders
+ def each_uploader
avatar_path = @project.avatar&.upload&.path
if @relative_export_path == 'avatar'
yield(@project.avatar)
else
- project_uploads_or_avatar(avatar_path).find_each(batch_size: UPLOADS_BATCH_SIZE) do |upload|
+ project_uploads_except_avatar(avatar_path).find_each(batch_size: UPLOADS_BATCH_SIZE) do |upload|
yield(upload.build_uploader)
end
end
end
- def project_uploads_or_avatar(avatar_path)
+ def project_uploads_except_avatar(avatar_path)
return @project.uploads unless avatar_path
@project.uploads.where("path != ?", avatar_path)
diff --git a/lib/gitlab/import_export/uploads_restorer.rb b/lib/gitlab/import_export/uploads_restorer.rb
index df24333cd74..25f85936227 100644
--- a/lib/gitlab/import_export/uploads_restorer.rb
+++ b/lib/gitlab/import_export/uploads_restorer.rb
@@ -12,7 +12,7 @@ module Gitlab
true
else
- true
+ true # Proceed without uploads
end
rescue => e
@shared.error(e)