From 7d37c2b9199fb59b4f84384e3b988c9e96aafc35 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Mon, 21 Nov 2016 12:33:40 -0500 Subject: [PATCH] FIX: digest email has broken images in popular topics section --- app/helpers/user_notifications_helper.rb | 6 ++++++ app/views/user_notifications/digest.html.erb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/helpers/user_notifications_helper.rb b/app/helpers/user_notifications_helper.rb index e65ea04a6c1..ad82c3c4f5e 100644 --- a/app/helpers/user_notifications_helper.rb +++ b/app/helpers/user_notifications_helper.rb @@ -97,4 +97,10 @@ module UserNotificationsHelper UrlHelper.absolute("#{Discourse.base_uri}/images/emails/#{basename}") end + def url_for_email(href) + URI(href).host.present? ? href : UrlHelper.absolute("#{Discourse.base_uri}#{href}") + rescue URI::InvalidURIError, URI::InvalidComponentError + href + end + end diff --git a/app/views/user_notifications/digest.html.erb b/app/views/user_notifications/digest.html.erb index 66a108b8b53..e77fd853558 100644 --- a/app/views/user_notifications/digest.html.erb +++ b/app/views/user_notifications/digest.html.erb @@ -129,7 +129,7 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo <% if t.image_url.present? %> - + <% end %>