fixes bug with smart annotations in reports [fixes SCI-1328]

This commit is contained in:
zmagod 2017-06-08 13:41:27 +02:00
parent fcec42ae31
commit e45c2ce560

View file

@ -229,11 +229,25 @@ module ApplicationHelper
raw(user_description) + raw('" >') + user_name + raw('</a>')
end
# Dirty, dirty hack for displaying images in reports
def user_avatar_absolute_url(user, style)
unless user.avatar(style) == '/images/icon_small/missing.png'
return user.avatar(style)
prefix = ''
if ENV['PAPERCLIP_STORAGE'].present? &&
ENV['MAIL_SERVER_URL'].present? &&
ENV['PAPERCLIP_STORAGE'] != 'filesystem'
prefix = ENV['MAIL_SERVER_URL']
end
URI.join(Rails.application.routes.url_helpers.root_url,
"/images/#{style}/missing.png").to_s
# for development
prefix = 'localhost:3000' if ENV['MAIL_SERVER_URL'] == 'localhost'
if !prefix.empty? &&
!prefix.include?('http://') &&
!prefix.include?('https://')
prefix = request.ssl? ? "https://#{prefix}" : "http://#{prefix}"
end
unless user.avatar(style) == '/images/icon_small/missing.png'
return user.avatar(style, timeout: Constants::URL_LONG_EXPIRE_TIME)
end
url_for(prefix + "/images/#{style}/missing.png")
end
end