Skip to content
This repository has been archived by the owner on Dec 8, 2017. It is now read-only.

Commit

Permalink
FIX: don't try to show svg's in summary email
Browse files Browse the repository at this point in the history
  • Loading branch information
nlalonde committed Nov 28, 2016
1 parent d9cf9e2 commit 4e09580
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/helpers/user_notifications_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ def digest_custom(i18n_key)
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
Expand Down
2 changes: 1 addition & 1 deletion app/views/user_notifications/digest.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 4e09580

Please sign in to comment.