aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-11-25 11:24:41 +0000
committerMatthew Somerville <matthew@mysociety.org>2019-12-05 11:36:14 +0000
commitc69131fd0f3a438cf459e0445ad1c7ae38a9c412 (patch)
tree4d63f5b0678d6390e2b1987086ba36c51fdd3170
parent9ca53c995ec010524e32cb76cd5e3f8725e9f423 (diff)
Add warning message at top of staging site emails.
-rw-r--r--perllib/FixMyStreet/App.pm1
-rw-r--r--perllib/FixMyStreet/Email.pm1
-rw-r--r--templates/email/default/_email_settings.html2
-rw-r--r--templates/email/default/_email_top.html11
4 files changed, 15 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index f62deae3a..5c6ed7992 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -373,6 +373,7 @@ sub construct_email {
};
$vars->{site_name} = Utils::trim_text($c->view('Email')->render($c, 'site-name.txt', $vars));
$vars->{signature} = $c->view('Email')->render($c, 'signature.txt', $vars);
+ $vars->{staging} = FixMyStreet->config('STAGING_SITE');
return if FixMyStreet::Email::is_abuser($c->model('DB')->schema, $vars->{to});
diff --git a/perllib/FixMyStreet/Email.pm b/perllib/FixMyStreet/Email.pm
index 49098b40d..3b97dffb9 100644
--- a/perllib/FixMyStreet/Email.pm
+++ b/perllib/FixMyStreet/Email.pm
@@ -172,6 +172,7 @@ sub send_cron {
});
$vars->{signature} = _render_template($tt, 'signature.txt', $vars);
$vars->{site_name} = Utils::trim_text(_render_template($tt, 'site-name.txt', $vars));
+ $vars->{staging} = FixMyStreet->config('STAGING_SITE');
$hdrs->{_body_} = _render_template($tt, $template, $vars);
if ($html_template) {
diff --git a/templates/email/default/_email_settings.html b/templates/email/default/_email_settings.html
index 180adbbeb..5bc7faa66 100644
--- a/templates/email/default/_email_settings.html
+++ b/templates/email/default/_email_settings.html
@@ -83,6 +83,8 @@ wrapper_min_width = 520 # in pixels without "px" suffix
hint_min_width = wrapper_min_width - (column_padding * 2)
hint_style = "min-width: ${ hint_min_width }px; padding: ${ column_padding }px; color: $body_text_color; font-size: 12px; line-height: 18px;"
+warning_style = "min-width: ${ hint_min_width }x; padding: ${ column_padding }px; background-color: $color_red_dark; color: $color_white;"
+
header_style = "padding: $header_padding; background: $header_background_color; color: $header_text_color;"
only_column_style = "padding: ${ column_padding }px; vertical-align: top; background-color: $primary_column_background_color; color: $primary_column_text_color;"
diff --git a/templates/email/default/_email_top.html b/templates/email/default/_email_top.html
index f7869ddb4..3087ffa30 100644
--- a/templates/email/default/_email_top.html
+++ b/templates/email/default/_email_top.html
@@ -47,6 +47,17 @@
</style>
</head>
<body style="[% body_style %]">
+[% IF staging AND NOT for_rss %]
+ <table [% wrapper_table %] style="[% td_style %]">
+ <tr>
+ <th class="spacer-cell"></th>
+ <th width="[% wrapper_max_width %]" style="[% td_style %][% warning_style %]" class="hint">
+ [% loc('This email was sent from a staging site.') %]
+ </th>
+ <th class="spacer-cell"></th>
+ </tr>
+ </table>
+[% END %]
<table [% wrapper_table %] style="[% wrapper_style %]">
<tr>
<th class="spacer-cell"></th>