diff --git a/app/models/upload.rb b/app/models/upload.rb index 5783a94d2d8..dec7de8f2f7 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -41,7 +41,6 @@ class Upload < ActiveRecord::Base ) if thumbnail - optimized_images << thumbnail self.width = width self.height = height save(validate: false) diff --git a/lib/tasks/avatars.rake b/lib/tasks/avatars.rake index c27dac792ff..4c1da8fd54f 100644 --- a/lib/tasks/avatars.rake +++ b/lib/tasks/avatars.rake @@ -21,9 +21,9 @@ task "avatars:clean" => :environment do puts "Cleaning up avatar thumbnails" puts - 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)") + OptimizedImage.where("upload_id IN (SELECT custom_upload_id FROM user_avatars) OR + upload_id IN (SELECT gravatar_upload_id FROM user_avatars) OR + upload_id IN (SELECT uploaded_avatar_id FROM users)") .find_each do |optimized_image| optimized_image.destroy! putc "." if (i += 1) % 10 == 0