BUGFIX: actually clean up all avatar thumbnails
This commit is contained in:
parent
18a2e7901e
commit
610f2dabd1
|
@ -16,8 +16,11 @@ task "avatars:clean" => :environment do
|
|||
i = 0
|
||||
puts "Cleaning up avatar thumbnails"
|
||||
puts
|
||||
custom_upload_ids = UserAvatar.where.not(custom_upload_id: nil).pluck(:custom_upload_id)
|
||||
OptimizedImage.where("upload_id IN (?)", custom_upload_ids).find_each do |optimized_image|
|
||||
|
||||
OptimizedImage.where("upload_id IN (SELECT custom_upload_id FROM user_avatars")
|
||||
.where("upload_id IN (SELECT gravatar_upload_id FROM user_avatars")
|
||||
.where("upload_id IN (SELECT uploaded_avatar_id FROM users")
|
||||
.find_each do |optimized_image|
|
||||
optimized_image.destroy!
|
||||
putc "." if (i += 1) % 10 == 0
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue