diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 8 | ||||
-rw-r--r-- | perllib/FixMyStreet/Script/Reports.pm | 1 | ||||
-rw-r--r-- | t/app/controller/report_inspect.t | 16 | ||||
-rw-r--r-- | t/app/sendreport/inspection_required.t | 15 | ||||
-rw-r--r-- | templates/web/base/report/_inspect.html | 20 | ||||
-rw-r--r-- | templates/web/oxfordshire/report/_inspect_extra_info.html | 8 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/staff.js | 20 |
7 files changed, 1 insertions, 87 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 662f865c3..c2c321b5d 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -475,14 +475,6 @@ sub inspect : Private { }; $c->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')) { - $update_params{extra} = { 'defect_raised' => 1 }; - $problem->set_extra_metadata( inspected => 1 ); - $c->forward( '/admin/log_edit', [ $problem->id, 'problem', 'inspected' ] ); - } } $problem->non_public($c->get_param('non_public') ? 1 : 0); diff --git a/perllib/FixMyStreet/Script/Reports.pm b/perllib/FixMyStreet/Script/Reports.pm index ecd461cd9..59de86db1 100644 --- a/perllib/FixMyStreet/Script/Reports.pm +++ b/perllib/FixMyStreet/Script/Reports.pm @@ -159,7 +159,6 @@ sub send(;$) { $reputation_threshold_met = $user_reputation >= $reputation_threshold; } unless ( - $row->get_extra_metadata('inspected') || $row->user->has_permission_to( trusted => $row->bodies_str_ids ) || $reputation_threshold_met ) { diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t index ef05288c7..d319f778a 100644 --- a/t/app/controller/report_inspect.t +++ b/t/app/controller/report_inspect.t @@ -144,7 +144,7 @@ FixMyStreet::override_config { $mech->get_ok("/report/$report_id"); $mech->submit_form_ok({ button => 'save', with_fields => { public_update => "This is a public update.", include_update => "1", - state => 'action scheduled', raise_defect => 1, + state => 'action scheduled', } }); $mech->get_ok("/report/$report_id"); $mech->submit_form_ok({ with_fields => { @@ -153,28 +153,23 @@ FixMyStreet::override_config { $report->discard_changes; my $comment = ($report->comments( undef, { order_by => { -desc => 'id' } } )->all)[1]->text; is $comment, "This is a public update.", 'Update was created'; - is $report->get_extra_metadata('inspected'), 1, 'report marked as inspected'; is $report->user->get_extra_metadata('reputation'), $reputation, "User reputation wasn't changed"; $mech->get_ok("/report/$report_id"); my $meta = $mech->extract_update_metas; like $meta->[0], qr/State changed to: Action scheduled/, 'First update mentions action scheduled'; - like $meta->[2], qr/Posted by .*defect raised/, 'Update mentions defect raised'; $user->unset_extra_metadata('categories'); $user->update; }; subtest "test update is required when instructing" => sub { - $report->unset_extra_metadata('inspected'); $report->update; - $report->inspection_log_entry->delete; $report->comments->delete_all; $mech->get_ok("/report/$report_id"); $mech->submit_form_ok({ button => 'save', with_fields => { public_update => undef, include_update => "1" } }); is_deeply $mech->page_errors, [ "Please provide a public update for this report." ], 'errors match'; $report->discard_changes; is $report->comments->count, 0, "Update wasn't created"; - is $report->get_extra_metadata('inspected'), undef, 'report not marked as inspected'; }; subtest "test location changes" => sub { @@ -627,7 +622,6 @@ FixMyStreet::override_config { subtest "test positive reputation" => sub { $user->user_body_permissions->create({ body => $oxon, permission_type => 'report_instruct' }); - $report->unset_extra_metadata('inspected'); $report->update; $report->inspection_log_entry->delete if $report->inspection_log_entry; my $reputation = $report->user->get_extra_metadata("reputation") || 0; @@ -636,24 +630,16 @@ FixMyStreet::override_config { state => 'in progress', include_update => undef, } }); $report->discard_changes; - is $report->get_extra_metadata('inspected'), undef, 'report not marked as inspected'; $mech->submit_form_ok({ button => 'save', with_fields => { state => 'action scheduled', include_update => undef, } }); $report->discard_changes; - is $report->get_extra_metadata('inspected'), undef, 'report not marked as inspected'; is $report->user->get_extra_metadata('reputation'), $reputation+1, "User reputation was increased"; $mech->submit_form_ok({ button => 'save', with_fields => { state => 'action scheduled', include_update => undef, - raise_defect => 1, } }); - $report->discard_changes; - is $report->get_extra_metadata('inspected'), 1, 'report marked as inspected'; - $mech->get_ok("/report/$report_id"); - my $meta = $mech->extract_update_metas; - like $meta->[-1], qr/Updated by .*defect raised/, 'Update mentions defect raised'; }; subtest "Oxfordshire-specific traffic management options are shown" => sub { diff --git a/t/app/sendreport/inspection_required.t b/t/app/sendreport/inspection_required.t index 64d6f70ee..5eff516f5 100644 --- a/t/app/sendreport/inspection_required.t +++ b/t/app/sendreport/inspection_required.t @@ -34,21 +34,8 @@ subtest "Report isn't sent if uninspected" => sub { is $report->whensent, undef, "Report hasn't been sent"; }; -subtest 'Report is sent when inspected' => sub { - $mech->clear_emails_ok; - $report->set_extra_metadata(inspected => 1); - $report->update; - - FixMyStreet::Script::Reports::send(); - - $report->discard_changes; - $mech->email_count_is( 1 ); - ok $report->whensent, 'Report marked as sent'; -}; - subtest 'Uninspected report is sent when made by trusted user' => sub { $mech->clear_emails_ok; - $report->unset_extra_metadata('inspected'); $report->whensent( undef ); $report->update; @@ -63,7 +50,6 @@ subtest 'Uninspected report is sent when made by trusted user' => sub { $report->discard_changes; $mech->email_count_is( 1 ); ok $report->whensent, 'Report marked as sent'; - is $report->get_extra_metadata('inspected'), undef, 'Report not marked as inspected'; }; subtest "Uninspected report isn't sent when user rep is too low" => sub { @@ -94,7 +80,6 @@ subtest 'Uninspected report is sent when user rep is high enough' => sub { $report->discard_changes; $mech->email_count_is( 1 ); ok $report->whensent, 'Report marked as sent'; - is $report->get_extra_metadata('inspected'), undef, 'Report not marked as inspected'; }; done_testing(); diff --git a/templates/web/base/report/_inspect.html b/templates/web/base/report/_inspect.html index 10f3b6b84..80c5cc1af 100644 --- a/templates/web/base/report/_inspect.html +++ b/templates/web/base/report/_inspect.html @@ -53,17 +53,6 @@ <label for="state">[% loc('State') %]</label> [% INCLUDE 'report/inspect/state_groups_select.html' %] </p> - [% IF permissions.report_instruct AND NOT problem.get_extra_metadata('inspected') %] - <div id="js-inspect-action-scheduled" class="[% "hidden" UNLESS problem.state == 'action scheduled' %]"> - <p>[% loc('Do you want to automatically raise a defect?') %]</p> - <p class="segmented-control segmented-control--radio"> - <input type="radio" name="raise_defect" id="raise_defect_yes" value="1"> - <label class="btn" for="raise_defect_yes">[% loc('Yes') %]</label> - <input type="radio" name="raise_defect" id="raise_defect_no" value="0"> - <label class="btn" for="raise_defect_no">[% loc('No') %]</label> - </p> - </div> - [% END %] <div id="js-duplicate-reports" class="[% "hidden" UNLESS problem.duplicate_of %]"> <input type="hidden" name="duplicate_of" value="[% problem.duplicate_of.id %]"> <p class="[% "hidden" UNLESS problem.duplicate_of %]"><strong>[% loc('Duplicate of') %]</strong></p> @@ -132,15 +121,6 @@ [% INCLUDE 'report/inspect/public_update.html' %] [% END %] - [% IF problem.get_extra_metadata('inspected') %] - [% IF problem.whensent %] - <p>[% loc("<strong>Note:</strong> This report has been sent onwards for action. Any changes made won't be passed on.") %]</p> - [% ELSE %] - <p>[% loc("<strong>Note:</strong> This report hasn't yet been sent onwards for action. Any changes made may not be passed on.") %]</p> - [% END %] - [% TRY %][% INCLUDE 'report/_inspect_extra_info.html' %][% CATCH file %][% END %] - [% END %] - <p> <input type="hidden" name="token" value="[% csrf_token %]" /> [% IF permissions.planned_reports %] diff --git a/templates/web/oxfordshire/report/_inspect_extra_info.html b/templates/web/oxfordshire/report/_inspect_extra_info.html deleted file mode 100644 index 6151d79ae..000000000 --- a/templates/web/oxfordshire/report/_inspect_extra_info.html +++ /dev/null @@ -1,8 +0,0 @@ -<p><small> -RDI sent: -[% IF problem.get_extra_metadata('rdi_processed') %] - [% problem.get_extra_metadata('rdi_processed') %] -[% ELSE %] - <strong>not yet sent</strong> -[% END %] -</small></p> diff --git a/web/cobrands/fixmystreet/staff.js b/web/cobrands/fixmystreet/staff.js index 17bd54b8b..cea136cb3 100644 --- a/web/cobrands/fixmystreet/staff.js +++ b/web/cobrands/fixmystreet/staff.js @@ -1,23 +1,4 @@ fixmystreet.staff_set_up = { - action_scheduled_raise_defect: function() { - $("#report_inspect_form").find('[name=state]').on('change', function() { - if ($(this).val() !== "action scheduled") { - $("#js-inspect-action-scheduled").addClass("hidden"); - $('#raise_defect_yes').prop('required', false); - $('#defect_type').prop('required', false); - } else { - $("#js-inspect-action-scheduled").removeClass("hidden"); - $('#raise_defect_yes').prop('required', true); - var dt_required = $('#defect_type')[0].length > 1 && $('input[name=raise_defect]:checked').val(); - $('#defect_type').prop('required', dt_required ? true : false); - } - }); - $('input[name=raise_defect]').change(function() { - var dt_required = $('#defect_type')[0].length > 1 && this.value; - $('#defect_type').prop('required', dt_required ? true : false); - }); - }, - list_item_actions: function() { $('#js-reports-list').on('click', ':submit', function(e) { e.preventDefault(); @@ -386,7 +367,6 @@ $(fixmystreet).on('display:report', function() { fixmystreet.staff_set_up.response_templates(); if ($("#report_inspect_form").length) { fixmystreet.staff_set_up.report_page_inspect(); - fixmystreet.staff_set_up.action_scheduled_raise_defect(); } }); |