aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2019-11-08 10:39:29 +0000
committerDave Arter <davea@mysociety.org>2019-12-09 12:50:07 +0000
commitc75acd2a3e8cc5abc10ea6ba116a078ca881944d (patch)
treecab2c09c3d50187c82c27a33b24a01ed2343d2a6
parentd2f56b45fd26955bafe9c216809230b94afbf9c3 (diff)
[TfL] Highlight safety critical reports in email subject
-rw-r--r--t/cobrand/tfl.t22
-rw-r--r--templates/email/tfl/submit.html2
-rw-r--r--templates/email/tfl/submit.txt4
3 files changed, 23 insertions, 5 deletions
diff --git a/t/cobrand/tfl.t b/t/cobrand/tfl.t
index 4ae21cdaa..14f7dce08 100644
--- a/t/cobrand/tfl.t
+++ b/t/cobrand/tfl.t
@@ -342,12 +342,14 @@ for my $host ( 'tfl.fixmystreet.com', 'www.fixmystreet.com', 'bromley.fixmystree
{
name => "test non-safety critical category",
safety_critical => 'no',
- category => "Traffic lights"
+ category => "Traffic lights",
+ subject => "Problem Report: Test Report",
},
{
name => "test safety critical category",
safety_critical => 'yes',
- category => "Pothole"
+ category => "Pothole",
+ subject => "Dangerous Pothole Report: Test Report",
},
{
name => "test category extra field - safety critical",
@@ -355,7 +357,8 @@ for my $host ( 'tfl.fixmystreet.com', 'www.fixmystreet.com', 'bromley.fixmystree
category => "Flooding",
extra_fields => {
location => "carriageway",
- }
+ },
+ subject => "Dangerous Flooding Report: Test Report",
},
{
name => "test category extra field - non-safety critical",
@@ -363,7 +366,8 @@ for my $host ( 'tfl.fixmystreet.com', 'www.fixmystreet.com', 'bromley.fixmystree
category => "Flooding",
extra_fields => {
location => "footway",
- }
+ },
+ subject => "Problem Report: Test Report",
},
) {
subtest $test->{name} . ' on ' . $host => sub {
@@ -407,6 +411,16 @@ for my $host ( 'tfl.fixmystreet.com', 'www.fixmystreet.com', 'bromley.fixmystree
is $report->get_extra_field_value('safety_critical'), $test->{safety_critical}, "safety critical flag set to " . $test->{safety_critical};
+ $mech->clear_emails_ok;
+ FixMyStreet::Script::Reports::send();
+ my @email = $mech->get_email;
+ is $email[0]->header('Subject'), $test->{subject};
+ if ($test->{safety_critical} eq 'yes') {
+ like $mech->get_text_body_from_email($email[0]), qr/This report is marked as safety critical./, "Safety critical message included in email body";
+ }
+ $mech->clear_emails_ok;
+
+
$mech->log_out_ok;
};
}
diff --git a/templates/email/tfl/submit.html b/templates/email/tfl/submit.html
index 96186a032..b7f9bb6df 100644
--- a/templates/email/tfl/submit.html
+++ b/templates/email/tfl/submit.html
@@ -16,6 +16,8 @@ INCLUDE '_email_top.html';
<p style="[% p_style %]">[% multiple %]A user of [% site_name %] has submitted the following report
of a local problem that they believe might require your attention.</p>
+ [% IF report.get_extra_field_value('safety_critical') == 'yes' %]<p>This report is marked as safety critical.</p>[% END %]
+
<p style="margin: 20px auto; text-align: center">
<a style="[% button_style %]" href="[% url %]">Show full report</a>
</p>
diff --git a/templates/email/tfl/submit.txt b/templates/email/tfl/submit.txt
index 61b5edee8..c99ed24c2 100644
--- a/templates/email/tfl/submit.txt
+++ b/templates/email/tfl/submit.txt
@@ -1,9 +1,11 @@
-Subject: Problem Report: [% report.title %]
+Subject: [% IF report.get_extra_field_value('safety_critical') == 'yes' %]Dangerous [% report.category %][% ELSE %]Problem[% END %] Report: [% report.title %]
[% multiple %]A user of
[% site_name %] has submitted the following report
of a local problem that they believe might require your attention.
+[% IF report.get_extra_field_value('safety_critical') == 'yes' %]This report is marked as safety critical.[% END %]
+
[% fuzzy %], or to provide an update on the problem,
please visit the following link: