Commit 2c37fa381e80135b7b2e87163a46ca2ecee15925

Authored by Sergey Linnik
1 parent 552c2d66

fix some glitches in gravatar image url generation

always use proper size value
do not show alt text when avatar image not loaded
app/decorators/commit_decorator.rb
... ... @@ -76,7 +76,7 @@ class CommitDecorator < ApplicationDecorator
76 76 source_name = send "#{options[:source]}_name".to_sym
77 77 source_email = send "#{options[:source]}_email".to_sym
78 78 text = if options[:avatar]
79   - avatar = h.image_tag h.gravatar_icon(source_email, options[:size]), class: "avatar #{"s#{options[:size]}" if options[:size]}", width: options[:size]
  79 + avatar = h.image_tag h.gravatar_icon(source_email, options[:size]), class: "avatar #{"s#{options[:size]}" if options[:size]}", width: options[:size], alt: ""
80 80 %Q{#{avatar} <span class="commit-#{options[:source]}-name">#{source_name}</span>}
81 81 else
82 82 source_name
... ...
app/helpers/application_helper.rb
... ... @@ -30,7 +30,9 @@ module ApplicationHelper
30 30 args.any? { |v| v.to_s.downcase == action_name }
31 31 end
32 32  
33   - def gravatar_icon(user_email = '', size = 40)
  33 + def gravatar_icon(user_email = '', size = nil)
  34 + size = 40 if size.nil? || size <= 0
  35 +
34 36 if Gitlab.config.disable_gravatar? || user_email.blank?
35 37 'no_avatar.png'
36 38 else
... ...