From 4eeb6014f47f50d6e9cab3ee556f32769b9ee001 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Sat, 30 Sep 2017 09:09:12 +0800 Subject: [PATCH] Don't raise an error if user has been destroyed. --- app/jobs/regular/create_avatar_thumbnails.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/regular/create_avatar_thumbnails.rb b/app/jobs/regular/create_avatar_thumbnails.rb index 046f50bfe1c..31942f6c6de 100644 --- a/app/jobs/regular/create_avatar_thumbnails.rb +++ b/app/jobs/regular/create_avatar_thumbnails.rb @@ -9,7 +9,7 @@ module Jobs raise Discourse::InvalidParameters.new(:upload_id) if upload_id.blank? return unless upload = Upload.find_by(id: upload_id) - return unless user = User.find(args[:user_id] || upload.user_id) + return unless user = User.find_by(args[:user_id] || upload.user_id) Discourse.avatar_sizes.each do |size| OptimizedImage.create_for(upload, size, size, filename: upload.original_filename, allow_animation: SiteSetting.allow_animated_avatars)