From 9a28052e92702463098570a181b2f7b2e8859b1e Mon Sep 17 00:00:00 2001
From: Yamagishi Kazutoshi <ykzts@desire.sh>
Date: Tue, 16 Jan 2018 14:26:46 +0900
Subject: [PATCH] Change image URL in mailer to full path (#6264)

---
 app/mailers/user_mailer.rb                                  | 2 ++
 app/views/layouts/mailer.html.haml                          | 4 ++--
 app/views/user_mailer/confirmation_instructions.html.haml   | 2 +-
 app/views/user_mailer/email_changed.html.haml               | 2 +-
 app/views/user_mailer/password_change.html.haml             | 2 +-
 app/views/user_mailer/reconfirmation_instructions.html.haml | 2 +-
 app/views/user_mailer/reset_password_instructions.html.haml | 2 +-
 7 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
index 7821be32b2e..a7efa73c1c7 100644
--- a/app/mailers/user_mailer.rb
+++ b/app/mailers/user_mailer.rb
@@ -5,6 +5,8 @@ class UserMailer < Devise::Mailer
 
   helper :instance
 
+  add_template_helper RoutingHelper
+
   def confirmation_instructions(user, token, **)
     @resource = user
     @token    = token
diff --git a/app/views/layouts/mailer.html.haml b/app/views/layouts/mailer.html.haml
index 8a7ce43691f..e41b910699e 100644
--- a/app/views/layouts/mailer.html.haml
+++ b/app/views/layouts/mailer.html.haml
@@ -24,7 +24,7 @@
                               %tr
                                 %td.column-cell
                                   = link_to root_url do
-                                    = image_tag asset_pack_path('logo_full.svg'), height: 34, class: 'logo'
+                                    = image_tag full_pack_url('logo_full.svg'), alt: 'Mastodon', height: 34, class: 'logo'
 
     = yield
 
@@ -52,4 +52,4 @@
                             %tbody
                               %td.column-cell.text-right
                                 = link_to root_url do
-                                  = image_tag asset_pack_path('logo_transparent.svg'), height: 24
+                                  = image_tag full_pack_url('logo_transparent.svg'), alt: 'Mastodon', height: 24
diff --git a/app/views/user_mailer/confirmation_instructions.html.haml b/app/views/user_mailer/confirmation_instructions.html.haml
index 7a148ec7273..0f999bcbcb2 100644
--- a/app/views/user_mailer/confirmation_instructions.html.haml
+++ b/app/views/user_mailer/confirmation_instructions.html.haml
@@ -17,7 +17,7 @@
                                 %tbody
                                   %tr
                                     %td
-                                      = image_tag asset_pack_path('icon_email.svg')
+                                      = image_tag full_pack_url('icon_email.svg'), alt: ''
 
                               %h1= t 'devise.mailer.confirmation_instructions.title'
 
diff --git a/app/views/user_mailer/email_changed.html.haml b/app/views/user_mailer/email_changed.html.haml
index e526f3a2c29..45dc0665090 100644
--- a/app/views/user_mailer/email_changed.html.haml
+++ b/app/views/user_mailer/email_changed.html.haml
@@ -17,7 +17,7 @@
                                 %tbody
                                   %tr
                                     %td
-                                      = image_tag asset_pack_path('icon_email.svg')
+                                      = image_tag full_pack_url('icon_email.svg'), alt: ''
 
                               %h1= t 'devise.mailer.email_changed.title'
                               %p.lead= t 'devise.mailer.email_changed.explanation'
diff --git a/app/views/user_mailer/password_change.html.haml b/app/views/user_mailer/password_change.html.haml
index a0afd593058..2e9377dff14 100644
--- a/app/views/user_mailer/password_change.html.haml
+++ b/app/views/user_mailer/password_change.html.haml
@@ -17,7 +17,7 @@
                                 %tbody
                                   %tr
                                     %td
-                                      = image_tag asset_pack_path('icon_lock_open.svg')
+                                      = image_tag full_pack_url('icon_lock_open.svg'), alt: ''
 
                               %h1= t 'devise.mailer.password_change.title'
                               %p.lead= t 'devise.mailer.password_change.explanation'
diff --git a/app/views/user_mailer/reconfirmation_instructions.html.haml b/app/views/user_mailer/reconfirmation_instructions.html.haml
index 52855e2232a..3ae22609393 100644
--- a/app/views/user_mailer/reconfirmation_instructions.html.haml
+++ b/app/views/user_mailer/reconfirmation_instructions.html.haml
@@ -17,7 +17,7 @@
                                 %tbody
                                   %tr
                                     %td
-                                      = image_tag asset_pack_path('icon_email.svg')
+                                      = image_tag full_pack_url('icon_email.svg'), alt: ''
 
                               %h1= t 'devise.mailer.reconfirmation_instructions.title'
                               %p.lead= t 'devise.mailer.reconfirmation_instructions.explanation'
diff --git a/app/views/user_mailer/reset_password_instructions.html.haml b/app/views/user_mailer/reset_password_instructions.html.haml
index c6a9d4bf6e6..c0e6775d4a9 100644
--- a/app/views/user_mailer/reset_password_instructions.html.haml
+++ b/app/views/user_mailer/reset_password_instructions.html.haml
@@ -17,7 +17,7 @@
                                 %tbody
                                   %tr
                                     %td
-                                      = image_tag asset_pack_path('icon_lock_open.svg')
+                                      = image_tag full_pack_url('icon_lock_open.svg'), alt: ''
 
                               %h1= t 'devise.mailer.reset_password_instructions.title'
                               %p.lead= t 'devise.mailer.reset_password_instructions.explanation'