mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 11:52:45 +08: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
|
@ -41,7 +41,6 @@ class Upload < ActiveRecord::Base
|
||||||
)
|
)
|
||||||
|
|
||||||
if thumbnail
|
if thumbnail
|
||||||
optimized_images << thumbnail
|
|
||||||
self.width = width
|
self.width = width
|
||||||
self.height = height
|
self.height = height
|
||||||
save(validate: false)
|
save(validate: false)
|
||||||
|
|
|
@ -21,9 +21,9 @@ task "avatars:clean" => :environment do
|
||||||
puts "Cleaning up avatar thumbnails"
|
puts "Cleaning up avatar thumbnails"
|
||||||
puts
|
puts
|
||||||
|
|
||||||
OptimizedImage.where("upload_id IN (SELECT custom_upload_id FROM user_avatars)")
|
OptimizedImage.where("upload_id IN (SELECT custom_upload_id FROM user_avatars) OR
|
||||||
.where("upload_id IN (SELECT gravatar_upload_id FROM user_avatars)")
|
upload_id IN (SELECT gravatar_upload_id FROM user_avatars) OR
|
||||||
.where("upload_id IN (SELECT uploaded_avatar_id FROM users)")
|
upload_id IN (SELECT uploaded_avatar_id FROM users)")
|
||||||
.find_each do |optimized_image|
|
.find_each do |optimized_image|
|
||||||
optimized_image.destroy!
|
optimized_image.destroy!
|
||||||
putc "." if (i += 1) % 10 == 0
|
putc "." if (i += 1) % 10 == 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user