FIX: respect the allow_animated_avatars site setting

This commit is contained in:
Régis Hanol 2015-05-26 12:22:02 +02:00
parent a797f7c664
commit 033c2e7140
2 changed files with 3 additions and 3 deletions

View File

@ -23,7 +23,7 @@ module Jobs
PIXELS.each do |pixel|
Discourse.avatar_sizes.each do |size|
size *= pixel
upload.create_thumbnail!(size, size)
upload.create_thumbnail!(size, size, SiteSetting.allow_animated_avatars)
end
end
end

View File

@ -24,9 +24,9 @@ class Upload < ActiveRecord::Base
thumbnail(width, height).present?
end
def create_thumbnail!(width, height)
def create_thumbnail!(width, height, allow_animation = SiteSetting.allow_animated_thumbnails)
return unless SiteSetting.create_thumbnails?
thumbnail = OptimizedImage.create_for(self, width, height, allow_animation: SiteSetting.allow_animated_thumbnails)
thumbnail = OptimizedImage.create_for(self, width, height, allow_animation: allow_animation)
if thumbnail
optimized_images << thumbnail
self.width = width