FIX: don't try to show svg's in summary email

This commit is contained in:
Neil Lalonde
2016-11-28 14:35:59 -05:00
parent d9cf9e2fb1
commit 4e0958051e
2 changed files with 5 additions and 1 deletions

View File

@ -93,6 +93,10 @@ module UserNotificationsHelper
PrettyText.format_for_email(I18n.t(i18n_key)).html_safe
end
def show_image_with_url(url)
!(url.nil? || url.downcase.end_with?('svg'))
end
def email_image_url(basename)
UrlHelper.absolute("#{Discourse.base_uri}/images/emails/#{basename}")
end

View File

@ -134,7 +134,7 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
<p style="color:#8f8f8f;line-height:1.3;margin:0 0 16px 0;padding:0;"><%= t.user.name -%></p>
<% end %>
</td>
<%- if t.image_url.present? -%>
<%- if show_image_with_url(t.image_url) -%>
<td style="margin:0;padding:0 16px 8px 8px;text-align:right;" align="right">
<img src="<%= url_for_email(t.image_url) -%>" height="64" style="margin:auto;max-height:64px;max-width:100%;outline:0;text-align:right;text-decoration:none;">
</td>