diff options
Diffstat (limited to 'perllib/FixMyStreet/App')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Dashboard.pm | 23 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 2 |
2 files changed, 17 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Dashboard.pm b/perllib/FixMyStreet/App/Controller/Dashboard.pm index 3a4480e85..058fa3806 100644 --- a/perllib/FixMyStreet/App/Controller/Dashboard.pm +++ b/perllib/FixMyStreet/App/Controller/Dashboard.pm @@ -548,13 +548,15 @@ sub heatmap_filters :Private { my ($self, $c, $where) = @_; # Wards - my @areas = @{$c->user->area_ids || []}; - # Want to get everything if nothing given in an ajax call - if (!$c->stash->{wards} && @areas) { - $c->stash->{wards} = [ map { { id => $_ } } @areas ]; - $where->{areas} = [ - map { { 'like', '%,' . $_ . ',%' } } @areas - ]; + if ($c->user_exists) { + my @areas = @{$c->user->area_ids || []}; + # Want to get everything if nothing given in an ajax call + if (!$c->stash->{wards} && @areas) { + $c->stash->{wards} = [ map { { id => $_ } } @areas ]; + $where->{areas} = [ + map { { 'like', '%,' . $_ . ',%' } } @areas + ]; + } } # Date range @@ -588,9 +590,14 @@ sub heatmap_sidebar :Private { my $params = { map { my $n = $_; s/me\./problem\./; $_ => $where->{$n} } keys %$where }; my $body = $c->stash->{body}; + + my @user; + push @user, $c->user->id if $c->user_exists; + push @user, $body->comment_user_id if $body->comment_user_id; + $params->{'me.user_id'} = { -not_in => \@user } if @user; + my @c = $c->model('DB::Comment')->to_body($body)->search({ %$params, - 'me.user_id' => { -not_in => [ $c->user->id, $body->comment_user_id || () ] }, 'me.state' => 'confirmed', }, { columns => 'problem_id', diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index cbbf8971a..ba37a25fa 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -691,6 +691,8 @@ sub setup_categories_and_bodies : Private { ->search( { 'me.body_id' => [ keys %bodies ] }, { prefetch => 'body' } ); my @contacts = $c->cobrand->categories_restriction($contacts)->all_sorted; + $c->cobrand->call_hook(munge_report_new_contacts => \@contacts); + # variables to populate my %bodies_to_list = (); # Bodies with categories assigned my @category_options = (); # categories to show |