diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Around.pm | 17 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/My.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 4 |
3 files changed, 8 insertions, 15 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index 7d382c228..c4040af95 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -240,7 +240,7 @@ sub check_location_is_acceptable : Private { =head2 check_and_stash_category -Check that the 'category' query param is valid, if it's present. Stores +Check that the 'filter_category' query param is valid, if it's present. Stores the validated string in the stash as filter_category. Puts all the valid categories in filter_categories on the stash. @@ -270,17 +270,10 @@ sub check_and_stash_category : Private { $c->stash->{filter_categories} = \@categories; - my $category = $c->req->param('category'); - if ( $category ) { - my $count = $c->model('DB::Contact')->not_deleted->search( - { - body_id => [ keys %bodies ], - category => $category - } - )->count; - if ( $count ) { - $c->stash->{filter_category} = $category; - } + my $category = $c->req->param('filter_category'); + my %categories_mapped = map { $_ => 1 } @categories; + if ( defined $category && $categories_mapped{$category} ) { + $c->stash->{filter_category} = $category; } } diff --git a/perllib/FixMyStreet/App/Controller/My.pm b/perllib/FixMyStreet/App/Controller/My.pm index 0cea3735a..0bcee7ac6 100644 --- a/perllib/FixMyStreet/App/Controller/My.pm +++ b/perllib/FixMyStreet/App/Controller/My.pm @@ -54,7 +54,7 @@ sub my : Path : Args(0) { %$params } if $c->cobrand->problems_clause; - my $category = $c->req->param('category'); + my $category = $c->req->param('filter_category'); if ( $category ) { $params->{category} = $category; $c->stash->{filter_category} = $category; diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index 82418fc48..e5f9d9507 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -137,7 +137,7 @@ sub ward : Path : Args(2) { } )->all; @categories = map { $_->category } @categories; $c->stash->{filter_categories} = \@categories; - $c->stash->{filter_category} = $c->req->param('category'); + $c->stash->{filter_category} = $c->req->param('filter_category'); my $pins = $c->stash->{pins}; @@ -394,7 +394,7 @@ sub load_and_group_problems : Private { my $page = $c->req->params->{p} || 1; my $type = $c->req->params->{t} || 'all'; - my $category = $c->req->params->{c} || $c->req->params->{category} || ''; + my $category = $c->req->params->{c} || $c->req->params->{filter_category} || ''; # Unlike the 't' query param, 'status' isn't affected by # the age of a report, so treat the filtering separately. |