mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Some fixes related to optimized images (#4233)
* FIX: No need to manually include relation. * FIX: OR instead of chaining relation.
This commit is contained in:
parent
0cf5a1705a
commit
0634834009
2 changed files with 3 additions and 4 deletions
|
@ -41,7 +41,6 @@ class Upload < ActiveRecord::Base
|
|||
)
|
||||
|
||||
if thumbnail
|
||||
optimized_images << thumbnail
|
||||
self.width = width
|
||||
self.height = height
|
||||
save(validate: false)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue