fix some glitches in gravatar image url generation

always use proper size value
do not show alt text when avatar image not loaded
This commit is contained in:
Sergey Linnik 2012-11-19 02:36:50 +04:00
parent 552c2d665b
commit 2c37fa381e
2 changed files with 4 additions and 2 deletions

View file

@ -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

View file

@ -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