diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-07 13:49:05 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-07 13:49:05 +0100 |
commit | 44819320af5533bb03a0855a75da0c9ffd207ee8 (patch) | |
tree | b42efd3598d5ef52eab09d3f58c8e451a3f67047 /perllib | |
parent | 719afb490479aa1cbc306b81a7534bb8a8affbf3 (diff) | |
parent | c93ebfa26b864c26b9219b59f6676371e434ea0a (diff) |
Merge branch 'issues/forcouncils/195-overloaded-action-scheduled'
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index ef10dc32e..81abba3ac 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -367,15 +367,9 @@ sub inspect : Private { if ( $problem->state ne $old_state ) { $c->forward( '/admin/log_edit', [ $problem->id, 'problem', 'state_change' ] ); - # If the state has been changed by an inspector, consider the - # report to be inspected. - unless ($problem->get_extra_metadata('inspected')) { - $problem->set_extra_metadata( inspected => 1 ); - $c->forward( '/admin/log_edit', [ $problem->id, 'problem', 'inspected' ] ); - my $state = $problem->state; - $reputation_change = 1 if $c->cobrand->reputation_increment_states->{$state}; - $reputation_change = -1 if $c->cobrand->reputation_decrement_states->{$state}; - } + my $state = $problem->state; + $reputation_change = 1 if $c->cobrand->reputation_increment_states->{$state}; + $reputation_change = -1 if $c->cobrand->reputation_decrement_states->{$state}; # If an inspector has changed the state, subscribe them to # updates @@ -386,6 +380,13 @@ sub inspect : Private { }; $problem->user->create_alert($problem->id, $options); } + + # If the state has been changed to action scheduled and they've said + # they want to raise a defect, consider the report to be inspected. + if ($problem->state eq 'action scheduled' && $c->get_param('raise_defect') && !$problem->get_extra_metadata('inspected')) { + $problem->set_extra_metadata( inspected => 1 ); + $c->forward( '/admin/log_edit', [ $problem->id, 'problem', 'inspected' ] ); + } } if ( !$c->forward( '/admin/report_edit_location', [ $problem ] ) ) { |