diff options
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 1 | ||||
-rw-r--r-- | t/cobrand/zurich.t | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index be73ed9c1..695d10439 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -1061,6 +1061,7 @@ sub _admin_send_email { my ( $c, $template, $problem ) = @_; return unless $problem->get_extra_metadata('email_confirmed'); + return if $problem->non_public; my $to = $problem->name ? [ $problem->user->email, $problem->name ] diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t index ce38f65d4..fb2c08550 100644 --- a/t/cobrand/zurich.t +++ b/t/cobrand/zurich.t @@ -775,6 +775,7 @@ subtest 'test flagged users make internal reports' => sub { $mech->submit_form( with_fields => { phone => "01234", category => 'Cat1', detail => 'Details' } ); $internal = FixMyStreet::DB->resultset('Problem')->search(undef, { order_by => { -desc => 'id' }, rows => 1 })->single; is $internal->non_public, 1; + $mech->clear_emails_ok; }; subtest 'internal report admin display' => sub { @@ -782,6 +783,24 @@ subtest 'internal report admin display' => sub { $mech->content_lacks('href="report_edit/' . $internal->id); $mech->get_ok('/admin/summary?internal=1'); $mech->content_contains('href="report_edit/' . $internal->id); +}; + +subtest 'test no email sent if closed' => sub { + $internal->state('feedback pending'); + $internal->set_extra_metadata('email_confirmed' => 1); + $internal->update; + + $mech->get_ok( '/admin/report_edit/' . $internal->id ); + $mech->submit_form_ok( { + button => 'publish_response', + with_fields => { + status_update => 'Testing no email sent', + } }); + + $internal->discard_changes; + is $internal->state, 'fixed - council'; + $mech->email_count_is(0); + $internal->delete; $mech->log_out_ok; }; |