diff options
-rw-r--r-- | perllib/FixMyStreet/Cobrand/TfL.pm | 14 | ||||
-rw-r--r-- | t/Mock/Tilma.pm | 27 |
2 files changed, 33 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/Cobrand/TfL.pm b/perllib/FixMyStreet/Cobrand/TfL.pm index b80929f25..8e133fa58 100644 --- a/perllib/FixMyStreet/Cobrand/TfL.pm +++ b/perllib/FixMyStreet/Cobrand/TfL.pm @@ -421,7 +421,19 @@ sub munge_reports_area_list { } sub munge_report_new_contacts { } -sub munge_report_new_bodies { } + +sub munge_report_new_bodies { + my ($self, $bodies) = @_; + + # Highways England handling + my $c = $self->{c}; + my $he = FixMyStreet::Cobrand::HighwaysEngland->new({ c => $c }); + my $on_he_road = $c->stash->{on_he_road} = $he->report_new_is_on_he_road; + + if (!$on_he_road) { + %$bodies = map { $_->id => $_ } grep { $_->name ne 'Highways England' } values %$bodies; + } +} sub munge_surrounding_london { my ($self, $bodies) = @_; diff --git a/t/Mock/Tilma.pm b/t/Mock/Tilma.pm index 5a11209e3..7542b1f5e 100644 --- a/t/Mock/Tilma.pm +++ b/t/Mock/Tilma.pm @@ -10,6 +10,18 @@ has json => ( }, ); +sub as_json { + my ($self, $features) = @_; + my $json = mySociety::Locale::in_gb_locale { + $self->json->encode({ + type => "FeatureCollection", + crs => { type => "name", properties => { name => "urn:ogc:def:crs:EPSG::27700" } }, + features => $features, + }); + }; + return $json; +} + sub dispatch_request { my $self = shift; @@ -25,15 +37,16 @@ sub dispatch_request { [ 539408.94, 170607.58 ], ] ] } } ]; } - my $json = mySociety::Locale::in_gb_locale { - $self->json->encode({ - type => "FeatureCollection", - crs => { type => "name", properties => { name => "urn:ogc:def:crs:EPSG::27700" } }, - features => $features, - }); - }; + my $json = $self->as_json($features); return [ 200, [ 'Content-Type' => 'application/json' ], [ $json ] ]; }, + + sub (GET + /mapserver/highways + ?*) { + my ($self, $args) = @_; + my $json = $self->as_json([]); + return [ 200, [ 'Content-Type' => 'application/json' ], [ $json ] ]; + }, + } __PACKAGE__->run_if_script; |