FIX: posts would not auto rebake unless gravatar download was enabled

FIX: posts would not auto rebake unless gravatar download was enabled
From 8e307e633eb7e3ef2b928fa45aff5245c40c870e Mon Sep 17 00:00:00 2001
From: Sam <sam.saffron@gmail.com>
Date: Fri, 7 Dec 2018 17:03:22 +1100
Subject: [PATCH] FIX: posts would not auto rebake unless gravatar download was
 enabled


diff --git a/app/jobs/scheduled/periodical_updates.rb b/app/jobs/scheduled/periodical_updates.rb
index 73f4804..2ab9517 100644
--- a/app/jobs/scheduled/periodical_updates.rb
+++ b/app/jobs/scheduled/periodical_updates.rb
@@ -28,7 +28,7 @@ module Jobs
       TopicTimer.ensure_consistency!
 
       # Forces rebake of old posts where needed, as long as no system avatars need updating
-      unless UserAvatar.where("last_gravatar_download_attempt IS NULL").limit(1).first
+      if !SiteSetting.automatically_download_gravatars || !UserAvatar.where("last_gravatar_download_attempt IS NULL").limit(1).first
         problems = Post.rebake_old(SiteSetting.rebake_old_posts_count)
         problems.each do |hash|
           post_id = hash[:post].id

GitHub

1 Like

@rishabhnambiar please approve this once you add a test for it

2 Likes