aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-09-06 14:08:26 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-09-06 14:31:52 +0100
commit1f69e28c518f4da9165ae03b749f3411ecec46fd (patch)
treec59629ec5f4843848d5e15f13c1d0f88dfbf519f /perllib
parent9b605c5730d637662663ce08e4257f941273928a (diff)
Check all contacts for metadata and non-public.
Previously it would only check the first matching entry, which could miss out on information if two bodies had the same category and only the second one looked at had metadata, or was marked as non-public.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm19
1 files changed, 13 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 8fadbac88..15d144e2a 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -671,19 +671,26 @@ sub setup_categories_and_bodies : Private {
$bodies_to_list{ $contact->body_id } = $contact->body;
+ my $metas = $contact->get_metadata_for_input;
+ if (@$metas) {
+ push @{$category_extras{$contact->category}}, @$metas;
+ my $all_hidden = (grep { !$c->cobrand->category_extra_hidden($_) } @$metas) ? 0 : 1;
+ if (exists($category_extras_hidden{$contact->category})) {
+ $category_extras_hidden{$contact->category} &&= $all_hidden;
+ } else {
+ $category_extras_hidden{$contact->category} = $all_hidden;
+ }
+ }
+
+ $non_public_categories{ $contact->category } = 1 if $contact->non_public;
+
unless ( $seen{$contact->category} ) {
push @category_options, $contact;
- my $metas = $contact->get_metadata_for_input;
- $category_extras{$contact->category} = $metas if @$metas;
- $category_extras_hidden{$contact->category} = (grep { !$c->cobrand->category_extra_hidden($_) } @$metas) ? 0 : 1;
-
my $body_send_method = $bodies{$contact->body_id}->send_method || '';
$c->stash->{unresponsive}{$contact->category} = $contact->body_id
if !$c->stash->{unresponsive}{ALL} &&
($contact->email =~ /^REFUSED$/i || $body_send_method eq 'Refused');
-
- $non_public_categories{ $contact->category } = 1 if $contact->non_public;
}
$seen{$contact->category} = $contact;
}