aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Admin.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-12-06 15:06:25 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-12-13 13:32:31 +0000
commitf982c8f38d192c7d4c3304ab5617df01be4176a6 (patch)
treee4f2a21dc1444de25a982b0d1960ff7ebd0fd633 /perllib/FixMyStreet/App/Controller/Admin.pm
parentae0449e38a8deb2bd88d904e006f55be137871cf (diff)
Fix issues with send method category change.
Use the send method recorded at the time of sending, not the current one (it may have changed since), and only resend if the new send methods are not a subset of the old.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm13
1 files changed, 5 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index e21b0cc2f..7b9bd6e96 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -960,17 +960,14 @@ sub report_edit_category : Private {
$problem->whensent(undef);
}
# If the send methods of the old/new contacts differ we need to resend the report
- my @old_contacts = grep { $_->category eq $category_old } @{$c->stash->{contacts}};
my @new_send_methods = uniq map {
( $_->body->can_be_devolved && $_->send_method ) ?
- $_->send_method : $_->body->send_method;
+ $_->send_method : $_->body->send_method
+ ? $_->body->send_method
+ : $c->cobrand->_fallback_body_sender()->{method};
} @contacts;
- my @old_send_methods = map {
- ( $_->body->can_be_devolved && $_->send_method ) ?
- $_->send_method : $_->body->send_method;
- } @old_contacts;
- if ( scalar @{ mySociety::ArrayUtils::symmetric_diff(\@old_send_methods, \@new_send_methods) } ) {
- $c->log->debug("Report changed, resending");
+ my %old_send_methods = map { $_ => 1 } split /,/, ($problem->send_method_used || "Email");
+ if (grep !$old_send_methods{$_}, @new_send_methods) {
$problem->whensent(undef);
}