diff options
author | James Lopez <james@jameslopez.es> | 2018-07-16 12:45:11 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2018-07-16 12:45:11 +0300 |
commit | 97ce0607d57d9a03fc6348a7ce3f9b069ced6c90 (patch) | |
tree | 9b0053422e97efaaffaa8e642549cb16375a4654 /lib/gitlab | |
parent | 07ec2c7bd00e6d0487e3f81864af982ec73365b2 (diff) |
refactor code based on feedback
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/import_export/uploads_manager.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/import_export/uploads_restorer.rb | 2 |
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) |