diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/FixMyStreet.pm | 9 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/TfL.pm | 6 |
3 files changed, 18 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index efa8ead93..97976ebe3 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -197,10 +197,12 @@ sub setup_categories_and_map :Private { my $pins = $c->stash->{pins} || []; + my $areas = [ $c->stash->{wards} ? map { $_->{id} } @{$c->stash->{wards}} : keys %{$c->stash->{body}->areas} ]; + $c->cobrand->call_hook(munge_reports_area_list => $areas); my %map_params = ( latitude => @$pins ? $pins->[0]{latitude} : 0, longitude => @$pins ? $pins->[0]{longitude} : 0, - area => [ $c->stash->{wards} ? map { $_->{id} } @{$c->stash->{wards}} : keys %{$c->stash->{body}->areas} ], + area => $areas, any_zoom => 1, ); FixMyStreet::Map::display_map( diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm index 9ab804c9f..97a0ab53a 100644 --- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm +++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm @@ -83,6 +83,15 @@ sub munge_reports_categories_list { } } +sub munge_reports_area_list { + my ($self, $areas) = @_; + my $c = $self->{c}; + if ($c->stash->{body}->name eq 'TfL') { + my %london_hash = map { $_ => 1 } FixMyStreet::Cobrand::TfL->london_boroughs; + @$areas = grep { $london_hash{$_} } @$areas; + } +} + sub munge_report_new_bodies { my ($self, $bodies) = @_; diff --git a/perllib/FixMyStreet/Cobrand/TfL.pm b/perllib/FixMyStreet/Cobrand/TfL.pm index 96f1d446d..d1cfb8d42 100644 --- a/perllib/FixMyStreet/Cobrand/TfL.pm +++ b/perllib/FixMyStreet/Cobrand/TfL.pm @@ -468,6 +468,12 @@ sub report_new_is_on_tlrn { return scalar @$features ? 1 : 0; } +sub munge_reports_area_list { + my ($self, $areas) = @_; + my %london_hash = map { $_ => 1 } $self->london_boroughs; + @$areas = grep { $london_hash{$_} } @$areas; +} + sub munge_report_new_contacts { } sub munge_report_new_bodies { } |