Commit 71f4ae4a authored by Micaël Bergeron's avatar Micaël Bergeron

fixing the move_to_* pattern

parent 787e4345
...@@ -8,6 +8,14 @@ class AvatarUploader < GitlabUploader ...@@ -8,6 +8,14 @@ class AvatarUploader < GitlabUploader
model.avatar.file && model.avatar.file.present? model.avatar.file && model.avatar.file.present?
end end
def move_to_store
false
end
def move_to_cache
false
end
private private
def dynamic_segment def dynamic_segment
......
...@@ -33,14 +33,12 @@ class GitlabUploader < CarrierWave::Uploader::Base ...@@ -33,14 +33,12 @@ class GitlabUploader < CarrierWave::Uploader::Base
cache_storage.is_a?(CarrierWave::Storage::File) cache_storage.is_a?(CarrierWave::Storage::File)
end end
# Reduce disk IO
def move_to_cache def move_to_cache
super.nil? ? true : super file_storage?
end end
# Reduce disk IO
def move_to_store def move_to_store
super.nil? ? true : super file_storage?
end end
def exists? def exists?
......
...@@ -202,14 +202,6 @@ module ObjectStorage ...@@ -202,14 +202,6 @@ module ObjectStorage
false false
end end
def move_to_store
false
end
def move_to_cache
false
end
def delete_migrated_file(migrated_file) def delete_migrated_file(migrated_file)
migrated_file.delete if exists? migrated_file.delete if exists?
end end
......
...@@ -19,7 +19,7 @@ FactoryBot.define do ...@@ -19,7 +19,7 @@ FactoryBot.define do
end end
trait :with_avatar do trait :with_avatar do
avatar { File.open(Rails.root.join('spec/fixtures/dk.png')) } avatar { fixture_file_upload('spec/fixtures/dk.png') }
end end
factory :group_with_members do factory :group_with_members do
......
...@@ -122,7 +122,7 @@ FactoryBot.define do ...@@ -122,7 +122,7 @@ FactoryBot.define do
end end
trait :with_avatar do trait :with_avatar do
avatar { File.open(Rails.root.join('spec/fixtures/dk.png')) } avatar { fixture_file_upload('spec/fixtures/dk.png') }
end end
trait :broken_storage do trait :broken_storage do
......
...@@ -42,7 +42,7 @@ FactoryBot.define do ...@@ -42,7 +42,7 @@ FactoryBot.define do
end end
trait :with_avatar do trait :with_avatar do
avatar { File.open(Rails.root.join('spec/fixtures/dk.png')) } avatar { fixture_file_upload('spec/fixtures/dk.png') }
end end
trait :two_factor_via_otp do trait :two_factor_via_otp 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