diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2c437a42c..501fa65ac 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -225,7 +225,8 @@ module ApplicationHelper user_name << ' ' + I18n.t('atwho.res.removed') if !user_still_in_team raw("") + + "alt='avatar' class='atwho-user-img-popover'" \ + " ref='#{'missing-img' if missing_avatar(user, :icon_small)}'>") + raw('#{text}".html_safe end - def sanitize_report_pdf(text, tags = [], attributes = []) - ActionController::Base.helpers.sanitize( - text, - tags: Constants::WHITELISTED_TAGS + tags, - attributes: Constants::WHITELISTED_ATTRIBUTES + attributes - ) + # Fixes issues with avatar images in reports + def fix_smart_annotation_image(html) + html_doc = Nokogiri::HTML(html) + html_doc.search('.atwho-user-popover').each do |el| + text = el.content + el.replace("#{text}") + end + html_doc.search('[ref="missing-img"]').each do |el| + tag = wicked_pdf_image_tag('icon_small/missing.png') + el.replace(tag) + end + html_doc.to_s end end diff --git a/app/views/reports/report.pdf.erb b/app/views/reports/report.pdf.erb index 36812a514..aaa96c774 100644 --- a/app/views/reports/report.pdf.erb +++ b/app/views/reports/report.pdf.erb @@ -10,7 +10,9 @@