diff options
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 2 | ||||
-rw-r--r-- | t/cobrand/zurich.t | 16 | ||||
-rw-r--r-- | templates/web/zurich/admin/report_edit.html | 18 |
3 files changed, 35 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 6e507037a..e15170721 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -459,7 +459,7 @@ sub admin_report_edit { $redirect = 1; } else { $problem->state( $c->req->params->{state} ) if $c->req->params->{state}; - if ( $problem->state eq 'hidden' ) { + if ( $problem->state eq 'hidden' && $c->req->params->{send_rejected_email} ) { _admin_send_email( $c, 'problem-rejected.txt', $problem ); } } diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t index 035cdafe0..6039017e9 100644 --- a/t/cobrand/zurich.t +++ b/t/cobrand/zurich.t @@ -367,6 +367,22 @@ $user->from_body( 2 ); $user->update; $mech->log_out_ok; +# Test hidden report email are only sent when requested +$user = $mech->log_in_ok( 'dm1@example.org') ; +$extra = $report->extra; +$extra->{email_confirmed} = 1; +$report->extra ( { %$extra } ); +$report->update; +$mech->get_ok( '/admin/report_edit/' . $report->id ); +$mech->submit_form_ok( { with_fields => { state => 'hidden', send_rejected_email => 1 } } ); +$mech->email_count_is(1); +$mech->clear_emails_ok; +$mech->get_ok( '/admin/report_edit/' . $report->id ); +$mech->submit_form_ok( { with_fields => { state => 'hidden', send_rejected_email => undef } } ); +$mech->email_count_is(0); +$mech->clear_emails_ok; +$mech->log_out_ok; + $mech->delete_problems_for_body( 2 ); $mech->delete_user( 'dm1@example.org' ); $mech->delete_user( 'sdm1@example.org' ); diff --git a/templates/web/zurich/admin/report_edit.html b/templates/web/zurich/admin/report_edit.html index 723086c46..648b91b08 100644 --- a/templates/web/zurich/admin/report_edit.html +++ b/templates/web/zurich/admin/report_edit.html @@ -103,6 +103,24 @@ [% END %] </select></p> +<p id="automatic-reply"> + <span class="mock-label">automatische Antwort</span> + <input type="checkbox" name="send_rejected_email" id="send_rejected_email" value="1" checked="checked" /> +</p> + +<script type="text/javascript"> +$(function(){ + // Show or hide the automatic reply field + $('#state').change(function(){ + if ($(this).val() === 'hidden') { + $('#automatic-reply').show(); + } else { + $('#automatic-reply').hide(); + } + }).change(); +}); +</script> + [% IF problem.state == 'unconfirmed' OR problem.state == 'confirmed' %] <ul class="no-bullets"> |