aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-06-16 16:16:49 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-06-20 17:59:59 +0100
commitbada68b27226eb2d0f119edf0fed866bd473b032 (patch)
tree49fca91166aab4bb148c001b3106c70bd8949834
parentac9be7b3038693fd5076d1c37648e059bf459527 (diff)
Don't resend if category change subsets body.
Instead of checking if the list of bodies has changed at all, mark the report for resending if there is a body in the new list not present in the old.
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 1f3307710..d354e6929 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -8,7 +8,6 @@ use Path::Class;
use POSIX qw(strftime strcoll);
use Digest::SHA qw(sha1_hex);
use mySociety::EmailUtil qw(is_valid_email is_valid_email_list);
-use mySociety::ArrayUtils;
use DateTime::Format::Strptime;
use List::Util 'first';
@@ -844,8 +843,9 @@ sub report_edit_category : Private {
$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 we need to resend it
- if (scalar @{mySociety::ArrayUtils::symmetric_diff($problem->bodies_str_ids, \@new_body_ids)}) {
+ # 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) {
$problem->whensent(undef);
}
$problem->bodies_str(join( ',', @new_body_ids ));