diff options
author | Dave Arter <davea@mysociety.org> | 2017-01-18 14:32:19 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2017-02-15 17:34:38 +0000 |
commit | 71e4186cefa356f240870cd5edf0e15b27e5e044 (patch) | |
tree | 035ee91ed97e48dda3efdfc478ed48149ec1f143 /perllib/FixMyStreet/App/Controller/Report.pm | |
parent | bb99a8917a9b7fc38f0c0847f45c68659791b54a (diff) |
Clarify ‘inspected’ behaviour
A report is now considered 'inspected' if its state was changed by an inspector.
Additionally, an AdminLog entry is created so the time of inspection and
inspector can be recorded.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 175db4a19..ad26ecf84 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -343,12 +343,9 @@ sub inspect : Private { $problem->set_extra_metadata( $_ => $c->get_param($_) ); } - if ( $c->get_param('save_inspected') ) { + if ( $c->get_param('include_update') ) { $update_text = Utils::cleanup_text( $c->get_param('public_update'), { allow_multiline => 1 } ); - if ($update_text) { - $problem->set_extra_metadata( inspected => 1 ); - $reputation_change = 1; - } else { + if (!$update_text) { $valid = 0; $c->stash->{errors} ||= []; push @{ $c->stash->{errors} }, _('Please provide a public update for this report.'); @@ -374,6 +371,14 @@ 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' ] ); + $reputation_change = 1; + } } } |