diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/BathNES.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/SendReport/Blackhole.pm | 20 | ||||
-rw-r--r-- | t/app/sendreport/blackhole.t | 42 | ||||
-rw-r--r-- | templates/email/lincolnshire/contact.html | 38 | ||||
-rw-r--r-- | templates/email/lincolnshire/contact.txt | 11 |
6 files changed, 113 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 285ac79f7..9975b272b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - Cobrand hook for disallowing title moderation. #2228 - Cobrand hook for per-questionnaire sending. #2231 - Add option for configuring memcache server. + - Add Blackhole send method. #2246 * v2.4 (6th September 2018) - Security diff --git a/perllib/FixMyStreet/Cobrand/BathNES.pm b/perllib/FixMyStreet/Cobrand/BathNES.pm index 82f79b776..c02c9328c 100644 --- a/perllib/FixMyStreet/Cobrand/BathNES.pm +++ b/perllib/FixMyStreet/Cobrand/BathNES.pm @@ -202,6 +202,7 @@ sub categories_restriction { 'me.send_method' => undef, # Open311 categories 'me.send_method' => '', # Open311 categories that have been edited in the admin 'me.send_method' => 'Email::BathNES', # Street Light Fault + 'me.send_method' => 'Blackhole', # Parks categories ] } ); } diff --git a/perllib/FixMyStreet/SendReport/Blackhole.pm b/perllib/FixMyStreet/SendReport/Blackhole.pm new file mode 100644 index 000000000..2c1a4fc8e --- /dev/null +++ b/perllib/FixMyStreet/SendReport/Blackhole.pm @@ -0,0 +1,20 @@ +package FixMyStreet::SendReport::Blackhole; + +use Moo; + +BEGIN { extends 'FixMyStreet::SendReport'; } + +=head2 send + +Immediately marks the report as successfully sent, but doesn't actually send +it anywhere. + +=cut + +sub send { + my $self = shift; + $self->success(1); + return 0; +} + +1; diff --git a/t/app/sendreport/blackhole.t b/t/app/sendreport/blackhole.t new file mode 100644 index 000000000..4335f3675 --- /dev/null +++ b/t/app/sendreport/blackhole.t @@ -0,0 +1,42 @@ +use FixMyStreet; +use FixMyStreet::DB; +use FixMyStreet::TestMech; +use FixMyStreet::Script::Reports; + +ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' ); + +my $user = $mech->create_user_ok( 'user@example.com' ); + +my $body = $mech->create_body_ok( 2551, 'Bath and North East Somerset Council'); +$body->update({ can_be_devolved => 1 }); + +my $contact = $mech->create_contact_ok( + body_id => $body->id, + category => 'Play area safety issue', + email => 'test@example.org', + send_method => 'Blackhole', +); + +my @reports = $mech->create_problems_for_body( 1, $body->id, 'Test', { + cobrand => 'bathnes', + category => $contact->category, + user => $user, +}); +my $report = $reports[0]; + +FixMyStreet::override_config { + STAGING_FLAGS => { send_reports => 1 }, +}, sub { + subtest "Report isn't sent anywhere" => sub { + $mech->clear_emails_ok; + + FixMyStreet::Script::Reports::send(); + + ok $mech->email_count_is(0), "Report email wasn't sent"; + + $report->discard_changes; + ok $report->whensent, "Report has been marked as sent"; + }; +}; + +done_testing(); diff --git a/templates/email/lincolnshire/contact.html b/templates/email/lincolnshire/contact.html new file mode 100644 index 000000000..d9e9b060a --- /dev/null +++ b/templates/email/lincolnshire/contact.html @@ -0,0 +1,38 @@ +[% + +subject_html = subject | html; +name = form_name | html; +email_summary = "“" _ subject_html _ "” – Message from " _ name _ " on " _ host; +email_footer = "Sent via " _ host _ ", IP " _ ip; +email_columns = 1; + +PROCESS '_email_settings.html'; + +INCLUDE '_email_top.html'; + +%] + +<th style="[% td_style %][% contact_meta_style %]"> + <table [% table_reset %]> + <tr> + <th style="[% contact_th_style %]">From</th> + <td style="[% contact_td_style %]">[% name %] <<a href="mailto:[% em | html %]">[% em | html %]</a>></td> + </tr> + </table> +</th> +</tr> + +<tr> +<th style="[% td_style %][% only_column_style %]"> + <h1 style="[% h1_style %]">[% subject | html %]</h1> + [% message | html | html_para | replace('<p>', '<p style="' _ p_style _ '">') %] + [%~ IF complaint %] + <p style="[% secondary_p_style %]"> + [% complaint | html %] + - <a href="[% problem_url %]">Report</a> + - <a href="[% admin_url %]">Admin</a> + </p> + [%~ END %] +</th> + +[% INCLUDE '_email_bottom.html' %] diff --git a/templates/email/lincolnshire/contact.txt b/templates/email/lincolnshire/contact.txt new file mode 100644 index 000000000..16abb3732 --- /dev/null +++ b/templates/email/lincolnshire/contact.txt @@ -0,0 +1,11 @@ +Subject: [% site_name %] message: [% subject %] + +[% message %] + +[% IF complaint %] +[ [% complaint %] - [% problem_url %] - [% admin_url %] ] +[% END %] + +-- +Sent by contact form on [% host %]. +IP address [% ip %] |