diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rwxr-xr-x | perllib/Open311/PostServiceRequestUpdates.pm | 4 | ||||
-rw-r--r-- | t/open311/post-service-request-updates.t | 4 |
3 files changed, 4 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index eeea670eb..7461fbf85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ - Improve inline checkbox spacing. #2411 - Prevent duplicate contact history creation with Unicode data. - Show all Open311 extra fields in edit admin. + - Proper bodies check for sending updates. - Development improvements: - Make front page cache time configurable. - Better working of /fakemapit/ under https. diff --git a/perllib/Open311/PostServiceRequestUpdates.pm b/perllib/Open311/PostServiceRequestUpdates.pm index e2172c028..c8ff2130f 100755 --- a/perllib/Open311/PostServiceRequestUpdates.pm +++ b/perllib/Open311/PostServiceRequestUpdates.pm @@ -52,18 +52,16 @@ sub process_body { my $o = Open311->new( $self->open311_params($body) ); - my $comments = FixMyStreet::DB->resultset('Comment')->search( { + my $comments = FixMyStreet::DB->resultset('Comment')->to_body($body)->search( { 'me.whensent' => undef, 'me.external_id' => undef, 'me.state' => 'confirmed', 'me.confirmed' => { '!=' => undef }, 'problem.whensent' => { '!=' => undef }, 'problem.external_id' => { '!=' => undef }, - 'problem.bodies_str' => { -like => '%' . $body->id . '%' }, 'problem.send_method_used' => { -like => '%Open311%' }, }, { - join => 'problem', order_by => [ 'confirmed', 'id' ], } ); diff --git a/t/open311/post-service-request-updates.t b/t/open311/post-service-request-updates.t index 5c8211bbf..901181501 100644 --- a/t/open311/post-service-request-updates.t +++ b/t/open311/post-service-request-updates.t @@ -15,8 +15,8 @@ my $params = { endpoint => 'endpoint', jurisdiction => 'home', }; -my $bromley = $mech->create_body_ok(2482, 'Bromley', { %$params, send_extended_statuses => 1 }); -my $oxon = $mech->create_body_ok(2237, 'Oxfordshire', $params); +my $bromley = $mech->create_body_ok(2482, 'Bromley', { %$params, send_extended_statuses => 1, id => 5 }); +my $oxon = $mech->create_body_ok(2237, 'Oxfordshire', { %$params, id => 55 }); my $bucks = $mech->create_body_ok(2217, 'Buckinghamshire', $params); my $lewisham = $mech->create_body_ok(2492, 'Lewisham', $params); |