aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Dashboard.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Dashboard.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Dashboard.pm23
1 files changed, 15 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',