1
0
mirror of https://github.com/meineerde/holgerjust.de.git synced 2025-10-17 17:01:01 +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
def gravatar(size = 68)
md5 = Digest::MD5.hexdigest(blog_author.gravatar_email.downcase)
"https://www.gravatar.com/avatar/#{md5}?size=#{size}"
if blog_author.avatar_url.present?
"#{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
def gravatar?
blog_author.avatar_url.present? ||
blog_author.gravatar_email.present?
end