diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-01-10 14:55:25 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-01-10 14:55:25 +0000 |
commit | 197c942e43eed14268f684151b0f088d926cf588 (patch) | |
tree | ab37a897141031eaab1885ce3031835d44625f6d | |
parent | 6508407642869999c1659b5eb3ffbf71895151ea (diff) |
[TfL] Hide ‘please ring’ categories in admin.
These categories display a ‘please ring’ message and so
have nowhere to be resent if selected.
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin/Reports.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/TfL.pm | 10 | ||||
-rw-r--r-- | t/cobrand/tfl.t | 13 |
3 files changed, 23 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin/Reports.pm b/perllib/FixMyStreet/App/Controller/Admin/Reports.pm index c57b207e2..ef9736ff6 100644 --- a/perllib/FixMyStreet/App/Controller/Admin/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Admin/Reports.pm @@ -485,6 +485,7 @@ sub categories_for_point : Private { my $prefetched_all_areas = [ grep { $_ } split ',', $c->stash->{report}->areas ]; $c->forward('/around/check_location_is_acceptable', [ $prefetched_all_areas ]); # As with a new report, fetch the bodies/categories + $c->stash->{categories_for_point} = 1; $c->forward('/report/new/setup_categories_and_bodies'); # Remove the "Pick a category" option diff --git a/perllib/FixMyStreet/Cobrand/TfL.pm b/perllib/FixMyStreet/Cobrand/TfL.pm index 797b872a4..e32711a02 100644 --- a/perllib/FixMyStreet/Cobrand/TfL.pm +++ b/perllib/FixMyStreet/Cobrand/TfL.pm @@ -83,7 +83,9 @@ sub base_url_for_report { sub categories_restriction { my ($self, $rs) = @_; - return $rs->search( { 'body.name' => 'TfL' } ); + $rs = $rs->search( { 'body.name' => 'TfL' } ); + return $rs unless $self->{c}->stash->{categories_for_point}; # Admin page + return $rs->search( { category => { -not_in => $self->_tfl_no_resend_categories } } ); } sub admin_user_domain { 'tfl.gov.uk' } @@ -498,4 +500,10 @@ sub _cleaning_groups { [ 'Street cleaning' ] } sub _tfl_council_category { 'General Litter / Rubbish Collection' } +sub _tfl_no_resend_categories { [ + 'General Litter / Rubbish Collection', + 'Other (TfL)', + 'Timings', +] } + 1; diff --git a/t/cobrand/tfl.t b/t/cobrand/tfl.t index e1990c946..5425bc0f7 100644 --- a/t/cobrand/tfl.t +++ b/t/cobrand/tfl.t @@ -96,6 +96,12 @@ $contact2->set_extra_fields({ ] }); $contact2->update; +my $contact2b = $mech->create_contact_ok( + body_id => $body->id, + category => 'Timings', + email => 'trafficlighttimings@example.com', +); + my $contact3 = $mech->create_contact_ok( body_id => $body->id, category => 'Pothole', @@ -397,6 +403,7 @@ subtest "change category, report resent to new location" => sub { $mech->log_in_ok( $superuser->email ); $mech->get_ok("/admin/report_edit/$id"); + $mech->content_lacks('Timings'); $mech->submit_form_ok({ with_fields => { category => 'Traffic lights' } }); FixMyStreet::Script::Reports::send(); @@ -707,6 +714,7 @@ for my $test ( 'Flytipping (Bromley)', # In the 'Street cleaning' group 'Grit bins', 'Pothole', + 'Timings', 'Traffic lights', 'Trees' ], @@ -722,6 +730,7 @@ for my $test ( 'Flooding (Bromley)', 'Flytipping (Bromley)', # In the 'Street cleaning' group 'Grit bins', + 'Timings', 'Traffic lights', 'Trees' ], @@ -736,6 +745,7 @@ for my $test ( 'Flooding', 'Grit bins', 'Pothole', + 'Timings', 'Traffic lights', 'Trees' ], @@ -750,6 +760,7 @@ for my $test ( 'Flooding', 'Grit bins', 'Pothole', + 'Timings', 'Traffic lights', 'Trees' ], @@ -766,6 +777,7 @@ for my $test ( 'Flytipping (Bromley)', 'Grit bins', 'Pothole', + 'Timings', 'Traffic lights', 'Trees' ], @@ -781,6 +793,7 @@ for my $test ( 'Flooding (Bromley)', 'Flytipping (Bromley)', 'Grit bins', + 'Timings', 'Traffic lights', 'Trees' ], |