1
0
mirror of https://github.com/meineerde/holgerjust.de.git synced 2025-12-24 01:11:13 +00:00

Allow to specify the final gravatar in the settings to avoid raw email adresses

This commit is contained in:
Holger Just 2015-12-05 23:58:33 +01:00
parent 954fdf872f
commit 9d0c0af54d

View File

@ -85,10 +85,15 @@ module MiddlemanCasperHelpers
end end
def gravatar(size = 68) def gravatar(size = 68)
md5 = Digest::MD5.hexdigest(blog_author.gravatar_email.downcase) if blog_author.avatar_url.present?
"https://www.gravatar.com/avatar/#{md5}?size=#{size}" "#{blog_author.avatar_url}?size=#{size}"
else
md5 = Digest::MD5.hexdigest(blog_author.gravatar_email.downcase)
"https://www.gravatar.com/avatar/#{md5}?size=#{size}"
end
end end
def gravatar? def gravatar?
blog_author.avatar_url.present? ||
blog_author.gravatar_email.present? blog_author.gravatar_email.present?
end end