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,8 +47,8 @@ class Contact | ||
47 | content_type: 'text/html', | 47 | content_type: 'text/html', |
48 | to: contact.dest.notification_emails, | 48 | to: contact.dest.notification_emails, |
49 | reply_to: contact.email, | 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 | if contact.sender | 54 | if contact.sender |
app/mailers/environment_mailing.rb
@@ -30,7 +30,7 @@ class EnvironmentMailing < Mailing | @@ -30,7 +30,7 @@ class EnvironmentMailing < Mailing | ||
30 | end | 30 | end |
31 | 31 | ||
32 | def signature_message | 32 | def signature_message |
33 | - _('Sent by %s.') % source.name | 33 | + _('Sent by %s.').html_safe % source.name |
34 | end | 34 | end |
35 | 35 | ||
36 | def url | 36 | def url |
app/mailers/mailing.rb
@@ -23,11 +23,11 @@ class Mailing < ApplicationRecord | @@ -23,11 +23,11 @@ class Mailing < ApplicationRecord | ||
23 | end | 23 | end |
24 | 24 | ||
25 | def generate_from | 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 | end | 27 | end |
28 | 28 | ||
29 | def generate_subject | 29 | def generate_subject |
30 | - '[%s] %s' % [source.name, subject] | 30 | + '[%s] %s'.html_safe % [source.name, subject] |
31 | end | 31 | end |
32 | 32 | ||
33 | def signature_message | 33 | def signature_message |
app/mailers/organization_mailing.rb
@@ -30,7 +30,7 @@ class OrganizationMailing < Mailing | @@ -30,7 +30,7 @@ class OrganizationMailing < Mailing | ||
30 | end | 30 | end |
31 | 31 | ||
32 | def signature_message | 32 | def signature_message |
33 | - _('Sent by community %s.') % source.name | 33 | + _('Sent by community %s.').html_safe % source.name |
34 | end | 34 | end |
35 | 35 | ||
36 | include Rails.application.routes.url_helpers | 36 | include Rails.application.routes.url_helpers |
app/mailers/pending_task_notifier.rb
@@ -12,8 +12,8 @@ class PendingTaskNotifier < ApplicationMailer | @@ -12,8 +12,8 @@ class PendingTaskNotifier < ApplicationMailer | ||
12 | 12 | ||
13 | mail( | 13 | mail( |
14 | to: person.email, | 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 | end | 18 | end |
19 | 19 |
app/mailers/scrap_notifier.rb
@@ -14,8 +14,8 @@ class ScrapNotifier < ApplicationMailer | @@ -14,8 +14,8 @@ class ScrapNotifier < ApplicationMailer | ||
14 | @url = sender.environment.top_url | 14 | @url = sender.environment.top_url |
15 | mail( | 15 | mail( |
16 | to: receiver.email, | 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 | end | 20 | end |
21 | end | 21 | end |
app/mailers/task_mailer.rb
@@ -14,7 +14,7 @@ class TaskMailer < ApplicationMailer | @@ -14,7 +14,7 @@ class TaskMailer < ApplicationMailer | ||
14 | mail( | 14 | mail( |
15 | to: task.target.notification_emails.compact, | 15 | to: task.target.notification_emails.compact, |
16 | from: self.class.generate_from(task), | 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 | end | 19 | end |
20 | 20 | ||
@@ -27,7 +27,7 @@ class TaskMailer < ApplicationMailer | @@ -27,7 +27,7 @@ class TaskMailer < ApplicationMailer | ||
27 | mail( | 27 | mail( |
28 | to: task.friend_email, | 28 | to: task.friend_email, |
29 | from: self.class.generate_from(task), | 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 | end | 32 | end |
33 | 33 | ||
@@ -43,7 +43,7 @@ class TaskMailer < ApplicationMailer | @@ -43,7 +43,7 @@ class TaskMailer < ApplicationMailer | ||
43 | mail_with_template( | 43 | mail_with_template( |
44 | to: task.requestor.notification_emails, | 44 | to: task.requestor.notification_emails, |
45 | from: self.class.generate_from(task), | 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 | email_template: task.email_template, | 47 | email_template: task.email_template, |
48 | template_params: {:environment => task.requestor.environment, :task => task, :message => @message, :url => @url, :requestor => task.requestor} | 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,8 +13,8 @@ class UserMailer < ApplicationMailer | ||
13 | 13 | ||
14 | mail( | 14 | mail( |
15 | to: user_email, | 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 | end | 19 | end |
20 | 20 | ||
@@ -30,7 +30,7 @@ class UserMailer < ApplicationMailer | @@ -30,7 +30,7 @@ class UserMailer < ApplicationMailer | ||
30 | mail_with_template( | 30 | mail_with_template( |
31 | from: "#{user.environment.name} <#{user.environment.contact_email}>", | 31 | from: "#{user.environment.name} <#{user.environment.contact_email}>", |
32 | to: user.email, | 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 | template_params: {:environment => user.environment, :activation_code => @activation_code, :redirection => @redirection, :join => @join, :person => user.person, :url => @url}, | 34 | template_params: {:environment => user.environment, :activation_code => @activation_code, :redirection => @redirection, :join => @join, :person => user.person, :url => @url}, |
35 | email_template: user.environment.email_templates.find_by_template_type(:user_activation), | 35 | email_template: user.environment.email_templates.find_by_template_type(:user_activation), |
36 | ) | 36 | ) |
@@ -44,8 +44,8 @@ class UserMailer < ApplicationMailer | @@ -44,8 +44,8 @@ class UserMailer < ApplicationMailer | ||
44 | mail( | 44 | mail( |
45 | content_type: 'text/html', | 45 | content_type: 'text/html', |
46 | to: user.email, | 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 | body: @body | 49 | body: @body |
50 | ) | 50 | ) |
51 | end | 51 | end |
@@ -63,8 +63,8 @@ class UserMailer < ApplicationMailer | @@ -63,8 +63,8 @@ class UserMailer < ApplicationMailer | ||
63 | mail( | 63 | mail( |
64 | content_type: 'text/html', | 64 | content_type: 'text/html', |
65 | to: user.email, | 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 | end | 69 | end |
70 | 70 |