refactor code based on feedback

parent 07ec2c7b
......@@ -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)
......
......@@ -12,7 +12,7 @@ module Gitlab
true
else
true
true # Proceed without uploads
end
rescue => e
@shared.error(e)
......
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