Commit 26c8903c9eb372138fbce9df53ab507dc6c8f47b
1 parent
e36981ca
Exists in
profile_api_improvements
and in
1 other branch
trust in html code generated for emails
Showing
8 changed files
with
20 additions
and
20 deletions
Show diff stats
app/mailers/contact.rb
| ... | ... | @@ -47,8 +47,8 @@ class Contact |
| 47 | 47 | content_type: 'text/html', |
| 48 | 48 | to: contact.dest.notification_emails, |
| 49 | 49 | reply_to: contact.email, |
| 50 | - subject: "[#{contact.dest.short_name(30)}] " + contact.subject, | |
| 51 | - from: "#{contact.name} <#{contact.dest.environment.noreply_email}>" | |
| 50 | + subject: "[#{contact.dest.short_name(30)}] #{contact.subject,}".html_safe, | |
| 51 | + from: "#{contact.name} <#{contact.dest.environment.noreply_email}>".html_safe | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | if contact.sender | ... | ... |
app/mailers/environment_mailing.rb
app/mailers/mailing.rb
| ... | ... | @@ -23,11 +23,11 @@ class Mailing < ApplicationRecord |
| 23 | 23 | end |
| 24 | 24 | |
| 25 | 25 | def generate_from |
| 26 | - "#{source.name} <#{if source.is_a? Environment then source.noreply_email else source.contact_email end}>" | |
| 26 | + "#{source.name} <#{if source.is_a? Environment then source.noreply_email else source.contact_email end}>".html_safe | |
| 27 | 27 | end |
| 28 | 28 | |
| 29 | 29 | def generate_subject |
| 30 | - '[%s] %s' % [source.name, subject] | |
| 30 | + '[%s] %s'.html_safe % [source.name, subject] | |
| 31 | 31 | end |
| 32 | 32 | |
| 33 | 33 | def signature_message | ... | ... |
app/mailers/organization_mailing.rb
app/mailers/pending_task_notifier.rb
| ... | ... | @@ -12,8 +12,8 @@ class PendingTaskNotifier < ApplicationMailer |
| 12 | 12 | |
| 13 | 13 | mail( |
| 14 | 14 | to: person.email, |
| 15 | - from: "#{person.environment.name} <#{person.environment.noreply_email}>", | |
| 16 | - subject: _("[%s] Pending tasks") % person.environment.name | |
| 15 | + from: "#{person.environment.name} <#{person.environment.noreply_email}>".html_safe, | |
| 16 | + subject: _("[%s] Pending tasks").html_safe % person.environment.name | |
| 17 | 17 | ) |
| 18 | 18 | end |
| 19 | 19 | ... | ... |
app/mailers/scrap_notifier.rb
| ... | ... | @@ -14,8 +14,8 @@ class ScrapNotifier < ApplicationMailer |
| 14 | 14 | @url = sender.environment.top_url |
| 15 | 15 | mail( |
| 16 | 16 | to: receiver.email, |
| 17 | - from: "#{sender.environment.name} <#{sender.environment.noreply_email}>", | |
| 18 | - subject: _("[%s] You received a scrap!") % [sender.environment.name] | |
| 17 | + from: "#{sender.environment.name} <#{sender.environment.noreply_email}>".html_safe, | |
| 18 | + subject: _("[%s] You received a scrap!").html_safe % [sender.environment.name] | |
| 19 | 19 | ) |
| 20 | 20 | end |
| 21 | 21 | end | ... | ... |
app/mailers/task_mailer.rb
| ... | ... | @@ -14,7 +14,7 @@ class TaskMailer < ApplicationMailer |
| 14 | 14 | mail( |
| 15 | 15 | to: task.target.notification_emails.compact, |
| 16 | 16 | from: self.class.generate_from(task), |
| 17 | - subject: "[%s] %s" % [task.environment.name, task.target_notification_description] | |
| 17 | + subject: "[%s] %s".html_safe % [task.environment.name, task.target_notification_description] | |
| 18 | 18 | ) |
| 19 | 19 | end |
| 20 | 20 | |
| ... | ... | @@ -27,7 +27,7 @@ class TaskMailer < ApplicationMailer |
| 27 | 27 | mail( |
| 28 | 28 | to: task.friend_email, |
| 29 | 29 | from: self.class.generate_from(task), |
| 30 | - subject: '[%s] %s' % [ task.requestor.environment.name, task.target_notification_description ] | |
| 30 | + subject: '[%s] %s'.html_safe % [ task.requestor.environment.name, task.target_notification_description ] | |
| 31 | 31 | ) |
| 32 | 32 | end |
| 33 | 33 | |
| ... | ... | @@ -43,7 +43,7 @@ class TaskMailer < ApplicationMailer |
| 43 | 43 | mail_with_template( |
| 44 | 44 | to: task.requestor.notification_emails, |
| 45 | 45 | from: self.class.generate_from(task), |
| 46 | - subject: '[%s] %s' % [task.requestor.environment.name, task.target_notification_description], | |
| 46 | + subject: '[%s] %s'.html_safe % [task.requestor.environment.name, task.target_notification_description], | |
| 47 | 47 | email_template: task.email_template, |
| 48 | 48 | template_params: {:environment => task.requestor.environment, :task => task, :message => @message, :url => @url, :requestor => task.requestor} |
| 49 | 49 | ) | ... | ... |
app/mailers/user_mailer.rb
| ... | ... | @@ -13,8 +13,8 @@ class UserMailer < ApplicationMailer |
| 13 | 13 | |
| 14 | 14 | mail( |
| 15 | 15 | to: user_email, |
| 16 | - from: "#{user.environment.name} <#{user.environment.contact_email}>", | |
| 17 | - subject: _("[%{environment}] Welcome to %{environment} mail!") % { :environment => user.environment.name } | |
| 16 | + from: "#{user.environment.name} <#{user.environment.contact_email}>".html_safe, | |
| 17 | + subject: _("[%{environment}] Welcome to %{environment} mail!").html_safe % { :environment => user.environment.name } | |
| 18 | 18 | ) |
| 19 | 19 | end |
| 20 | 20 | |
| ... | ... | @@ -30,7 +30,7 @@ class UserMailer < ApplicationMailer |
| 30 | 30 | mail_with_template( |
| 31 | 31 | from: "#{user.environment.name} <#{user.environment.contact_email}>", |
| 32 | 32 | to: user.email, |
| 33 | - subject: _("[%s] Activate your account") % [user.environment.name], | |
| 33 | + subject: _("[%s] Activate your account").html_safe % [user.environment.name], | |
| 34 | 34 | template_params: {:environment => user.environment, :activation_code => @activation_code, :redirection => @redirection, :join => @join, :person => user.person, :url => @url}, |
| 35 | 35 | email_template: user.environment.email_templates.find_by_template_type(:user_activation), |
| 36 | 36 | ) |
| ... | ... | @@ -44,8 +44,8 @@ class UserMailer < ApplicationMailer |
| 44 | 44 | mail( |
| 45 | 45 | content_type: 'text/html', |
| 46 | 46 | to: user.email, |
| 47 | - from: "#{user.environment.name} <#{user.environment.contact_email}>", | |
| 48 | - subject: email_subject.blank? ? _("Welcome to environment %s") % [user.environment.name] : email_subject, | |
| 47 | + from: "#{user.environment.name} <#{user.environment.contact_email}>".html_safe, | |
| 48 | + subject: email_subject.blank? ? _("Welcome to environment %s").html_safe % [user.environment.name] : email_subject, | |
| 49 | 49 | body: @body |
| 50 | 50 | ) |
| 51 | 51 | end |
| ... | ... | @@ -63,8 +63,8 @@ class UserMailer < ApplicationMailer |
| 63 | 63 | mail( |
| 64 | 64 | content_type: 'text/html', |
| 65 | 65 | to: user.email, |
| 66 | - from: "#{user.environment.name} <#{user.environment.contact_email}>", | |
| 67 | - subject: _("[%s] What about grow up your network?") % user.environment.name | |
| 66 | + from: "#{user.environment.name} <#{user.environment.contact_email}>".html_safe, | |
| 67 | + subject: _("[%s] What about grow up your network?").html_safe % user.environment.name | |
| 68 | 68 | ) |
| 69 | 69 | end |
| 70 | 70 | ... | ... |