diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin/Bodies.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Dashboard.pm | 23 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 2 |
3 files changed, 19 insertions, 9 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm b/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm index 3b7739966..18bcbbc5f 100644 --- a/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm +++ b/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm @@ -248,7 +248,8 @@ sub update_contact : Private { my $email = $c->get_param('email'); $email =~ s/\s+//g; my $send_method = $c->get_param('send_method') || $contact->body->send_method || ""; - unless ( $send_method eq 'Open311' ) { + my $email_unchanged = $contact->email && $email && $contact->email eq $email; + unless ( $send_method eq 'Open311' || $email_unchanged ) { $errors{email} = _('Please enter a valid email') unless is_valid_email_list($email) || $email eq 'REFUSED'; } 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 |