diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 8 | ||||
-rw-r--r-- | t/app/controller/report_inspect.t | 20 |
3 files changed, 27 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 9249149bd..bbf001338 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Fix issue displaying admin timeline. #2159 - Send details of unresponsive bodies to mobile app #2164 - Fix issue with category filter when category contains comma #2166 + - Inspectors can unset priority. #2171 - Open311 improvements: - CLOSED status maps to 'closed' state if extended statuses are enabled. diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index f5d7db069..669d3c41f 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -462,8 +462,12 @@ sub inspect : Private { } # Updating priority must come after category, in case category has changed (and so might have priorities) - if ($c->get_param('priority') && ($permissions->{report_inspect} || $permissions->{report_edit_priority})) { - $problem->response_priority( $problem->response_priorities->find({ id => $c->get_param('priority') }) ); + if ($permissions->{report_inspect} || $permissions->{report_edit_priority}) { + if ($c->get_param('priority')) { + $problem->response_priority( $problem->response_priorities->find({ id => $c->get_param('priority') }) ); + } else { + $problem->response_priority(undef); + } } if ($valid) { diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t index 6a001225d..260339da8 100644 --- a/t/app/controller/report_inspect.t +++ b/t/app/controller/report_inspect.t @@ -414,6 +414,26 @@ FixMyStreet::override_config { is $report->response_priority, undef, 'response priority set'; }; + subtest "check can unset priority" => sub { + $report->discard_changes; + $report->update({ category => 'Cows', response_priority_id => $rp->id }); + $report->discard_changes; + is $report->response_priority->id, $rp->id, 'response priority set'; + $user->user_body_permissions->delete; + $user->user_body_permissions->create({ body => $oxon, permission_type => 'report_edit_category' }); + $user->user_body_permissions->create({ body => $oxon, permission_type => 'report_edit_priority' }); + $mech->get_ok("/report/$report_id"); + $mech->submit_form_ok({ + button => 'save', + with_fields => { + priority => "", + } + }); + + $report->discard_changes; + is $report->response_priority, undef, 'response priority unset'; + }; + subtest "check nearest address display" => sub { $mech->get_ok("/report/$report_id"); $mech->content_lacks('Nearest calculated address', 'No address displayed'); |