Update gravatar methods to check for Active Storage images

This commit is contained in:
Tom Hughes 2019-07-16 18:34:50 +01:00
parent b911b45961
commit 3cfffc2258
3 changed files with 2 additions and 19 deletions

View file

@ -5,7 +5,7 @@
start = 0
User.where("image_use_gravatar AND id >=" + start.to_s).order("id").find_each do |user|
p "checked up to id " + user.id.to_s if (user.id % 1000).zero? # just give a rough indication where we are for restarting
next if user.image.present?
next if user.avatar.attached?
hash = Digest::MD5.hexdigest(user.email.downcase)
url = "https://www.gravatar.com/avatar/#{hash}?d=404" # without d=404 we will always get an image back