aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Around.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-04-13 14:29:56 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-04-13 14:35:58 +0100
commit112ab20142f7f79d4ffff557b95c53406ad79bd9 (patch)
tree20f32e6faa1449c6345a8ffeb428dfc440cfddee /perllib/FixMyStreet/App/Controller/Around.pm
parentcfe97d706f5cb7b3f3ca6d9227a872a7e50d97b2 (diff)
Fix issue with categories with regex characters.
As the templates were using `grep`, they failed to match on a category such as "Footpaths (right of way)". Changing the stash variables to be hashes instead of lists makes checking for a key simpler. Fixes #1688.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Around.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Around.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm
index 96854b17b..1fe35d0a3 100644
--- a/perllib/FixMyStreet/App/Controller/Around.pm
+++ b/perllib/FixMyStreet/App/Controller/Around.pm
@@ -182,7 +182,7 @@ sub display_location : Private {
my ( $on_map_all, $on_map, $nearby, $distance ) =
FixMyStreet::Map::map_features( $c,
latitude => $latitude, longitude => $longitude,
- interval => $interval, categories => $c->stash->{filter_category},
+ interval => $interval, categories => [ keys %{$c->stash->{filter_category}} ],
states => $c->stash->{filter_problem_states},
order => $c->stash->{sort_order},
);
@@ -264,8 +264,8 @@ sub check_and_stash_category : Private {
my %categories_mapped = map { $_ => 1 } @categories;
my $categories = [ $c->get_param_list('filter_category', 1) ];
- my @valid_categories = grep { $_ && $categories_mapped{$_} } @$categories;
- $c->stash->{filter_category} = \@valid_categories;
+ my %valid_categories = map { $_ => 1 } grep { $_ && $categories_mapped{$_} } @$categories;
+ $c->stash->{filter_category} = \%valid_categories;
}
=head2 /ajax