aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Report.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-04-17 14:07:32 +0100
committerMatthew Somerville <matthew@mysociety.org>2020-05-08 08:35:45 +0100
commitd1622dc20c1623e3f7fb54d72d99370af796c197 (patch)
tree790277735485c4ef3514cedbed03c89c0a4d620e /perllib/FixMyStreet/App/Controller/Report.pm
parentecc5a7b9ca20418f1bdb45cdc3ce5b41a11f3593 (diff)
Extend assigned_*_only to report lists.
Shortlist buttons and extended print information will not appear where not allowed.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm13
1 files changed, 13 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index 3052b1015..8a6047194 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -724,6 +724,19 @@ sub stash_category_groups : Private {
$c->stash->{category_groups} = \@category_groups;
}
+sub assigned_users_only : Private {
+ my ($self, $c, $categories) = @_;
+
+ # Assigned only category checking
+ if ($c->user_exists && $c->user->from_body) {
+ my @assigned_users_only = grep { $_->get_extra_metadata('assigned_users_only') } @$categories;
+ $c->stash->{assigned_users_only} = { map { $_->category => 1 } @assigned_users_only };
+ $c->stash->{assigned_categories_only} = $c->user->get_extra_metadata('assigned_categories_only');
+
+ $c->stash->{user_categories} = { map { $_ => 1 } @{$c->user->categories} };
+ }
+}
+
__PACKAGE__->meta->make_immutable;
1;