aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm7
-rw-r--r--perllib/FixMyStreet/Cobrand/Bexley.pm2
-rw-r--r--t/cobrand/bexley.t13
-rw-r--r--templates/web/base/admin/report_edit.html2
5 files changed, 19 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9af06e8df..c73664501 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,7 @@
- Upgrade the underlying framework and a number of other packages.
- Add feature cobrand helper function.
- Add front-end testing support for WSL.
+ - Allow cobrands to disable admin resending.
- Open311 improvements:
- Support use of 'private' service definition <keywords> to mark
reports made in that category private.
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index e9c9b6174..2de274c61 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -460,7 +460,7 @@ sub report_edit : Path('report_edit') : Args(1) {
$c->detach('report_edit_display') if $done;
}
- if ( $c->get_param('resend') ) {
+ if ( $c->get_param('resend') && !$c->cobrand->call_hook('disable_resend') ) {
$c->forward('/auth/check_csrf_token');
$problem->resend;
@@ -572,13 +572,14 @@ sub report_edit_category : Private {
my ($self, $c, $problem, $no_comment) = @_;
if ((my $category = $c->get_param('category')) ne $problem->category) {
+ my $disable_resend = $c->cobrand->call_hook('disable_resend');
my $category_old = $problem->category;
$problem->category($category);
my @contacts = grep { $_->category eq $problem->category } @{$c->stash->{contacts}};
my @new_body_ids = map { $_->body_id } @contacts;
# If the report has changed bodies (and not to a subset!) we need to resend it
my %old_map = map { $_ => 1 } @{$problem->bodies_str_ids};
- if (grep !$old_map{$_}, @new_body_ids) {
+ if (!$disable_resend && grep !$old_map{$_}, @new_body_ids) {
$problem->resend;
}
# If the send methods of the old/new contacts differ we need to resend the report
@@ -589,7 +590,7 @@ sub report_edit_category : Private {
: $c->cobrand->_fallback_body_sender()->{method};
} @contacts;
my %old_send_methods = map { $_ => 1 } split /,/, ($problem->send_method_used || "Email");
- if (grep !$old_send_methods{$_}, @new_send_methods) {
+ if (!$disable_resend && grep !$old_send_methods{$_}, @new_send_methods) {
$problem->resend;
}
diff --git a/perllib/FixMyStreet/Cobrand/Bexley.pm b/perllib/FixMyStreet/Cobrand/Bexley.pm
index af344e545..1f16b817e 100644
--- a/perllib/FixMyStreet/Cobrand/Bexley.pm
+++ b/perllib/FixMyStreet/Cobrand/Bexley.pm
@@ -21,6 +21,8 @@ sub disambiguate_location {
};
}
+sub disable_resend { 1 }
+
sub on_map_default_status { 'open' }
sub open311_munge_update_params {
diff --git a/t/cobrand/bexley.t b/t/cobrand/bexley.t
index 40908b869..f72b7e7c4 100644
--- a/t/cobrand/bexley.t
+++ b/t/cobrand/bexley.t
@@ -53,6 +53,7 @@ FixMyStreet::override_config {
$mech->content_contains('Bexley');
};
+ my $report;
foreach my $test (
{ category => 'Abandoned and untaxed vehicles', email => 1, code => 'ABAN',
extra => { 'name' => 'burnt', description => 'Was it burnt?', 'value' => 'Yes' } },
@@ -79,9 +80,9 @@ FixMyStreet::override_config {
{ category => 'Lamp post', code => 'LAMP', email => 'p1.*thirdparty',
extra => { 'name' => 'dangerous', description => 'Was it dangerous?', 'value' => 'Yes' } },
) {
- my ($report) = $mech->create_problems_for_body(1, $body->id, 'On Road', {
+ ($report) = $mech->create_problems_for_body(1, $body->id, 'On Road', {
category => $test->{category}, cobrand => 'bexley',
- latitude => 51.408484, longitude => 0.074653,
+ latitude => 51.408484, longitude => 0.074653, areas => '2494',
});
if ($test->{extra}) {
$report->set_extra_fields(ref $test->{extra} eq 'ARRAY' ? @{$test->{extra}} : $test->{extra});
@@ -110,6 +111,14 @@ FixMyStreet::override_config {
};
}
+ subtest 'resend is disabled in admin' => sub {
+ my $user = $mech->log_in_ok('super@example.org');
+ $user->update({ from_body => $body, is_superuser => 1 });
+ $mech->get_ok('/admin/report_edit/' . $report->id);
+ $mech->content_contains('View report on site');
+ $mech->content_lacks('Resend report');
+ };
+
};
subtest 'nearest road returns correct road' => sub {
diff --git a/templates/web/base/admin/report_edit.html b/templates/web/base/admin/report_edit.html
index e7d126558..da800ff71 100644
--- a/templates/web/base/admin/report_edit.html
+++ b/templates/web/base/admin/report_edit.html
@@ -81,7 +81,7 @@ class="admin-offsite-link">[% problem.latitude %], [% problem.longitude %]</a>
[% IF problem.send_method_used %]
([% problem.send_method_used %])
[% END %]
- [% IF problem.state == 'confirmed' AND problem.whensent %]
+ [% IF problem.state == 'confirmed' AND problem.whensent AND NOT c.cobrand.disable_resend %]
<input data-confirm="[% loc('Are you sure?') %]" class="btn" type="submit" name="resend" value="[% loc('Resend report') %]">
[% ELSIF NOT problem.whensent %]
<input type="submit" class="btn" name="mark_sent" value="[% loc('Mark as sent') %]">