提交 2c37fa38 编写于 作者: S Sergey Linnik

fix some glitches in gravatar image url generation

always use proper size value
do not show alt text when avatar image not loaded
上级 552c2d66
......@@ -76,7 +76,7 @@ class CommitDecorator < ApplicationDecorator
source_name = send "#{options[:source]}_name".to_sym
source_email = send "#{options[:source]}_email".to_sym
text = if options[:avatar]
avatar = h.image_tag h.gravatar_icon(source_email, options[:size]), class: "avatar #{"s#{options[:size]}" if options[:size]}", width: options[:size]
avatar = h.image_tag h.gravatar_icon(source_email, options[:size]), class: "avatar #{"s#{options[:size]}" if options[:size]}", width: options[:size], alt: ""
%Q{#{avatar} <span class="commit-#{options[:source]}-name">#{source_name}</span>}
else
source_name
......
......@@ -30,7 +30,9 @@ module ApplicationHelper
args.any? { |v| v.to_s.downcase == action_name }
end
def gravatar_icon(user_email = '', size = 40)
def gravatar_icon(user_email = '', size = nil)
size = 40 if size.nil? || size <= 0
if Gitlab.config.disable_gravatar? || user_email.blank?
'no_avatar.png'
else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册