]> git.openstreetmap.org Git - rails.git/blobdiff - lib/tasks/upgrade_avatars.rake
Update gravatar methods to check for Active Storage images
[rails.git] / lib / tasks / upgrade_avatars.rake
diff --git a/lib/tasks/upgrade_avatars.rake b/lib/tasks/upgrade_avatars.rake
deleted file mode 100644 (file)
index 03939da..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace "storage" do
-  task :upgrade_avatars => :environment do
-    User.active.where.not(:image_file_name => nil).in_batches.each_record do |user|
-      io = File.open(user.image.path)
-      filename = user.image.original_filename
-      content_type = if user.image.content_type.nil?
-                       MimeMagic.by_magic(io)&.type
-                     else
-                       user.image.content_type
-                     end
-
-      user.avatar.attach(:io => io, :filename => filename, :content_type => content_type)
-    end
-  end
-end