diff options
author | James Lopez <james@jameslopez.es> | 2018-07-13 15:41:24 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2018-07-13 15:41:24 +0200 |
commit | dae0d809ea66ac76bac63f17b6c4f9c8ce360a06 (patch) | |
tree | c35f2ef7a5f59926dfb1030e0ef313f9a5847463 | |
parent | c2d297d97a62ddbde0ffcab3a69662684d60f8aa (diff) | |
download | gitlab-ce-dae0d809ea66ac76bac63f17b6c4f9c8ce360a06.tar.gz |
refactor uploads manager
-rw-r--r-- | lib/gitlab/import_export/uploads_manager.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/gitlab/import_export/uploads_manager.rb b/lib/gitlab/import_export/uploads_manager.rb index 3e756bdaa79..4af547e616e 100644 --- a/lib/gitlab/import_export/uploads_manager.rb +++ b/lib/gitlab/import_export/uploads_manager.rb @@ -56,11 +56,11 @@ module Gitlab def copy_from_object_storage return unless Gitlab::ImportExport.object_storage? - uploads do |upload_model| - next unless upload_model.file - next if upload_model.upload.local? # Already copied, using the old method + uploaders do |uploader| + next unless uploader.file + next if uploader.upload.local? # Already copied, using the old method - download_and_copy(upload_model) + download_and_copy(uploader) end end @@ -72,19 +72,19 @@ module Gitlab @uploads_export_path ||= File.join(@shared.export_path, @relative_export_path) end - def uploads + def uploader avatar_path = @project.avatar&.upload&.path if @relative_export_path == 'avatar' yield(@project.avatar) else - project_uploads(avatar_path).find_each(batch_size: UPLOADS_BATCH_SIZE) do |upload| + project_uploads_or_avatar(avatar_path).find_each(batch_size: UPLOADS_BATCH_SIZE) do |upload| yield(upload.build_uploader) end end end - def project_uploads(avatar_path) + def project_uploads_or_avatar(avatar_path) return @project.uploads unless avatar_path @project.uploads.where("path != ?", avatar_path) |