diff options
Diffstat (limited to 'perllib/Open311')
-rw-r--r-- | perllib/Open311/GetServiceRequestUpdates.pm | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm index ae1f06a50..f7b758137 100644 --- a/perllib/Open311/GetServiceRequestUpdates.pm +++ b/perllib/Open311/GetServiceRequestUpdates.pm @@ -127,7 +127,9 @@ sub update_comments { # actually changing the state of the problem if ( FixMyStreet::DB::Result::Problem->council_states()->{$state} && $p->state ne $state && !( $p->is_fixed && FixMyStreet::DB::Result::Problem->fixed_states()->{$state} ) ) { - $p->state($state); + if ($p->is_visible) { + $p->state($state); + } $comment->problem_state($state); } } @@ -137,17 +139,19 @@ sub update_comments { $comment->insert(); if ( $self->suppress_alerts ) { - my $alert = FixMyStreet::App->model('DB::Alert')->find( { + my @alerts = FixMyStreet::App->model('DB::Alert')->search( { alert_type => 'new_updates', parameter => $p->id, confirmed => 1, user_id => $p->user->id, } ); - my $alerts_sent = FixMyStreet::App->model('DB::AlertSent')->find_or_create( { - alert_id => $alert->id, - parameter => $comment->id, - } ); + for my $alert (@alerts) { + my $alerts_sent = FixMyStreet::App->model('DB::AlertSent')->find_or_create( { + alert_id => $alert->id, + parameter => $comment->id, + } ); + } } } } |