From 4d1e8356b8ec3516d593cc34011375a004771877 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 5 Jun 2013 18:23:43 -0400 Subject: [PATCH] FIX: Again, try to get a flexible absolute logo_url --- app/helpers/application_helper.rb | 2 +- app/views/email/template.html.erb | 2 +- lib/email_renderer.rb | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 074329b9e66..88a93627acc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -12,7 +12,7 @@ module ApplicationHelper def discourse_csrf_tags # anon can not have a CSRF token cause these are all pages - # that may be cached, causing a mismatch between session CSRF + # that may be cached, causing a mismatch between session CSRF # and CSRF on page and horrible impossible to debug login issues if current_user csrf_meta_tags diff --git a/app/views/email/template.html.erb b/app/views/email/template.html.erb index f24b453f8dd..7d62724db29 100644 --- a/app/views/email/template.html.erb +++ b/app/views/email/template.html.erb @@ -7,7 +7,7 @@ - <%= image_tag(SiteSetting.logo_url, style: "height: 50px; margin-bottom: 15px; ") %> + diff --git a/lib/email_renderer.rb b/lib/email_renderer.rb index 560fa8a2721..e2cc6fc9f8e 100644 --- a/lib/email_renderer.rb +++ b/lib/email_renderer.rb @@ -13,10 +13,16 @@ class EmailRenderer def html formatted_body = EmailStyles.new(PrettyText.cook(text, environment: 'email')).format + logo_url = SiteSetting.logo_url + if logo_url !~ /http(s)?\:\/\// + logo_url = "#{Discourse.base_url}#{logo_url}" + end + ActionView::Base.new(Rails.configuration.paths["app/views"]).render( template: 'email/template', format: :html, - locals: { html_body: formatted_body } + locals: { html_body: formatted_body, + logo_url: logo_url } ) end