aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Report/New.pm
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2016-07-08 10:27:14 +0100
committerDave Arter <davea@mysociety.org>2016-07-08 14:29:28 +0100
commit49207ca458921d79527b832efce32f7ab0dfe6c0 (patch)
treec0fe2fa2494fec0b75ab7e1dd6188fe6010da041 /perllib/FixMyStreet/App/Controller/Report/New.pm
parent5cc37b53df6eef31e94dfe5e434ae149068bc892 (diff)
[Bristol] Only show Open311 categories on Bristol cobrand
This adds a new Cobrand::Default::categories_restriction method that can be used to limit what categories are available when making a new report on a per-cobrand basis. This is used by Cobrand::Bristol to only show Open311 categories when making a new report on fixmystreet.bristol.gov.uk but allowing all categories on FMS.com. Also removes the Hart::hidden_categories and uses the new categories_restriction method to achieve the same thing.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/New.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm15
1 files changed, 3 insertions, 12 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 9779a5e2a..c4a2162a8 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -602,12 +602,12 @@ sub setup_categories_and_bodies : Private {
my %bodies = map { $_->id => $_ } @bodies;
my $first_body = ( values %bodies )[0];
- my @contacts #
+ my $contacts #
= $c #
->model('DB::Contact') #
->not_deleted #
- ->search( { body_id => [ keys %bodies ] } )
- ->all;
+ ->search( { body_id => [ keys %bodies ] } );
+ my @contacts = $c->cobrand->categories_restriction($contacts)->all;
# variables to populate
my %bodies_to_list = (); # Bodies with categories assigned
@@ -670,15 +670,6 @@ sub setup_categories_and_bodies : Private {
$c->cobrand->munge_category_list(\@category_options, \@contacts, \%category_extras)
if $c->cobrand->can('munge_category_list');
- if ($c->cobrand->can('hidden_categories')) {
- my %hidden_categories = map { $_ => 1 }
- $c->cobrand->hidden_categories;
-
- @category_options = grep {
- !$hidden_categories{$_}
- } @category_options;
- }
-
# put results onto stash for display
$c->stash->{bodies} = \%bodies;
$c->stash->{all_body_names} = [ map { $_->name } values %bodies ];