From 16795605e4fc3374525f4115ed84d10a4430e875 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 10 Apr 2018 21:15:52 +0200 Subject: [PATCH] Fixed bug: Changes to Setting 'html_email_css_font' are only reflected after restarting Zammad. --- app/models/channel/email_build.rb | 6 +- app/views/mailer/application_wrapper.html.erb | 76 +++++++++++++++++ config/initializers/html_email_style.rb | 83 ------------------- 3 files changed, 81 insertions(+), 84 deletions(-) create mode 100644 app/views/mailer/application_wrapper.html.erb delete mode 100644 config/initializers/html_email_style.rb diff --git a/app/models/channel/email_build.rb b/app/models/channel/email_build.rb index ae8f12959..b01182cbf 100644 --- a/app/models/channel/email_build.rb +++ b/app/models/channel/email_build.rb @@ -152,9 +152,13 @@ Check if string is a complete html document. If not, add head and css styles. return html if html.match?(//i) + html_email_body = File.read('app/views/mailer/application_wrapper.html.erb') + + html_email_body.gsub!('###html_email_css_font###', Setting.get('html_email_css_font')) + # use block form because variable html could contain backslashes and e. g. '\1' that # must not be handled as back-references for regular expressions - Rails.configuration.html_email_body.sub('###html###') { html } + html_email_body.sub('###html###') { html } end =begin diff --git a/app/views/mailer/application_wrapper.html.erb b/app/views/mailer/application_wrapper.html.erb new file mode 100644 index 000000000..34aa0f22a --- /dev/null +++ b/app/views/mailer/application_wrapper.html.erb @@ -0,0 +1,76 @@ + + + + + + + + ###html### + \ No newline at end of file diff --git a/config/initializers/html_email_style.rb b/config/initializers/html_email_style.rb deleted file mode 100644 index ae92feb21..000000000 --- a/config/initializers/html_email_style.rb +++ /dev/null @@ -1,83 +0,0 @@ -if ActiveRecord::Base.connection.table_exists?( Setting.table_name ) - - html_email_css_font = Setting.get('html_email_css_font') - - Rails.application.config.html_email_body = <<~HERE - - - - - - - - ###html### - - HERE -end