aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--CHANGELOG.md1
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm13
2 files changed, 6 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 32f05c9de..0e73a903a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -38,6 +38,7 @@
- Superusers without a from_body can make reports again. #1913
- Fix crash when viewing /around in certain locales. #1916
- Fix back bug, from report after using list filters. #1920
+ - Fix issues with send method category change. #1933
- Admin improvements:
- Character length limit can be placed on report detailed information #1848
- Inspector panel shows nearest address if available #1850
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);
}