Skip to content

Commit

Permalink
[webui] Remove unused user_icon code
Browse files Browse the repository at this point in the history
The user_icon function is never called with the parameter size < 3.
That means the code is obviously not necessary.

Cherry picked from master
a26a88b
  • Loading branch information
ChrisBr committed Oct 30, 2015
1 parent ac92e85 commit 0efcc1d
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/api/app/helpers/webui/webui_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,8 @@ def user_icon(user, size=20, css_class=nil, alt=nil)
user = User.find_by_login!(user) unless user.is_a? User
alt ||= user.realname
alt = user.login if alt.empty?
if size < 3 # TODO: needs more work, if the icon appears often on the page, it's cheaper to fetch it
content = user.gravatar_image(size)
if content == :none
content = Rails.cache.fetch('default_face') do
File.open(Rails.root.join('app', 'assets', 'images',
'default_face.png'), 'r').read
end
end
"<img src='data:image/jpeg;base64,#{Base64.encode64(content)}' width='#{size}' height='#{size}' alt='#{alt}' class='#{css_class}'/>".html_safe
else
image_tag(url_for(controller: :user, action: :icon, user: user.login, size: size),
width: size, height: size, alt: alt, class: css_class)
end
image_tag(url_for(controller: :user, action: :icon, icon: user.login, size: size),
width: size, height: size, alt: alt, class: css_class)
end

def fuzzy_time(time)
Expand Down

0 comments on commit 0efcc1d

Please sign in to comment.