diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Around.pm | 6 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/TfL.pm | 6 | ||||
-rw-r--r-- | t/cobrand/tfl.t | 4 |
3 files changed, 14 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index 49ff13999..fb3670fb7 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -329,12 +329,14 @@ sub nearby : Path { my ($self, $c) = @_; my $states = FixMyStreet::DB::Result::Problem->open_states(); - $c->forward('/report/_nearby_json', [ { + my $params = { latitude => $c->get_param('latitude'), longitude => $c->get_param('longitude'), categories => [ $c->get_param('filter_category') || () ], states => $states, - } ]); + }; + $c->cobrand->call_hook('around_nearby_filter', $params); + $c->forward('/report/_nearby_json', [ $params ]); } sub location_closest_address : Path('/ajax/closest') { diff --git a/perllib/FixMyStreet/Cobrand/TfL.pm b/perllib/FixMyStreet/Cobrand/TfL.pm index e4a4bced6..1449a9614 100644 --- a/perllib/FixMyStreet/Cobrand/TfL.pm +++ b/perllib/FixMyStreet/Cobrand/TfL.pm @@ -172,6 +172,12 @@ sub admin_allow_user { return $user->from_body->name eq 'TfL'; } +sub around_nearby_filter { + my ($self, $params) = @_; + # Include all reports in duplicate spotting + delete $params->{states}; +} + sub state_groups_inspect { my $rs = FixMyStreet::DB->resultset("State"); my @open = grep { $_ !~ /^(planned|action scheduled|for triage)$/ } FixMyStreet::DB::Result::Problem->open_states; diff --git a/t/cobrand/tfl.t b/t/cobrand/tfl.t index 5425bc0f7..61d851422 100644 --- a/t/cobrand/tfl.t +++ b/t/cobrand/tfl.t @@ -283,6 +283,10 @@ subtest "test report creation anonymously by staff user" => sub { is $report->state, 'confirmed', "report confirmed"; $mech->get_ok( '/report/' . $report->id ); + $report->update({ state => 'fixed - council' }); + my $json = $mech->get_ok_json('/around/nearby?latitude=' . $report->latitude . '&longitude=' . $report->longitude); + is @{$json->{pins}}, 2, 'right number of pins'; + is $report->bodies_str, $body->id; is $report->name, 'Anonymous user'; is $report->user->email, 'anonymous@tfl.gov.uk'; |