diff options
-rw-r--r-- | t/app/controller/report_inspect.t | 14 | ||||
-rw-r--r-- | templates/web/oxfordshire/report/inspect/state_groups_select.html | 5 |
2 files changed, 16 insertions, 3 deletions
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t index 00b4e3b38..9d2ae0b0f 100644 --- a/t/app/controller/report_inspect.t +++ b/t/app/controller/report_inspect.t @@ -221,12 +221,22 @@ FixMyStreet::override_config { subtest "Oxfordshire-specific traffic management options are shown" => sub { $report->update({ state => 'confirmed' }); $mech->get_ok("/report/$report_id"); - $mech->submit_form_ok({ button => 'save', with_fields => { traffic_information => 'Signs and Cones', state => 'Action Scheduled', include_update => undef } }); + $mech->submit_form_ok({ button => 'save', with_fields => { traffic_information => 'Signs and Cones', state => 'Investigating', include_update => undef } }); $report->discard_changes; - is $report->state, 'action scheduled', 'report state changed'; + is $report->state, 'investigating', 'report state changed'; is $report->get_extra_metadata('traffic_information'), 'Signs and Cones', 'report data changed'; }; + subtest "No action scheduled without the right permission" => sub { + $report->update({ state => 'confirmed' }); + $mech->get_ok("/report/$report_id"); + $mech->content_lacks('action scheduled'); + + $user->user_body_permissions->create({ body => $oxon, permission_type => 'report_instruct' }); + $mech->get_ok("/report/$report_id"); + $mech->content_like(qr/<optgroup label="Scheduled">\s*<option value="action scheduled">Action Scheduled<\/option>/); + }; + }; FixMyStreet::override_config { diff --git a/templates/web/oxfordshire/report/inspect/state_groups_select.html b/templates/web/oxfordshire/report/inspect/state_groups_select.html index d9db3864a..529e6f403 100644 --- a/templates/web/oxfordshire/report/inspect/state_groups_select.html +++ b/templates/web/oxfordshire/report/inspect/state_groups_select.html @@ -11,11 +11,14 @@ SET state_pretty = { SET state_groups = [ [ loc('New'), [ 'confirmed', 'investigating' ] ], - [ loc('Scheduled'), [ 'action scheduled' ] ], [ loc('Fixed'), [ 'fixed - council' ] ], [ loc('Closed'), [ 'not responsible', 'duplicate', 'unable to fix' ] ] ]; +IF c.user_exists AND c.user.has_body_permission_to('report_instruct'); + CALL state_groups.splice(1, 0, [ [ loc('Scheduled'), [ 'action scheduled' ] ] ]); +END + %] [% DEFAULT current_state = problem.state %] [% INCLUDE 'report/_state_select_field.html' %] |