diff options
author | Dave Arter <davea@mysociety.org> | 2018-03-27 15:03:01 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2018-04-03 12:44:24 +0100 |
commit | 097e2e3c4a45aee4e449d8d77704fd8979dd68e5 (patch) | |
tree | e7fd7dc7bb3cb0c095b04fa10fafb2fbeee1cc0f | |
parent | b890d9779a53fb0cd07c10f2e19728b57700931f (diff) |
[Buckinghamshire] Don’t send updates not made by original reporter
-rwxr-xr-x | bin/send-comments | 13 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Buckinghamshire.pm | 8 |
2 files changed, 20 insertions, 1 deletions
diff --git a/bin/send-comments b/bin/send-comments index aecedcb08..4293417f5 100755 --- a/bin/send-comments +++ b/bin/send-comments @@ -100,7 +100,18 @@ while ( my $body = $bodies->next ) { } while ( my $comment = $comments->next ) { - my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($comment->cobrand)->new(); + my $cobrand = $body->get_cobrand_handler || + FixMyStreet::Cobrand->get_class_for_moniker($comment->cobrand)->new(); + + # Some cobrands (e.g. Buckinghamshire) don't want to receive updates + # from anyone except the original problem reporter. + if ($cobrand->call_hook(should_skip_sending_update => $comment)) { + unless (defined $comment->get_extra_metadata('cobrand_skipped_sending')) { + $comment->set_extra_metadata(cobrand_skipped_sending => 1); + $comment->update; + } + next; + } # TODO actually this should be OK for any devolved endpoint if original Open311->can_be_devolved, presumably if ( 0 ) { # Check can_be_devolved and do this properly if set diff --git a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm index 360704d40..42cb52532 100644 --- a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm +++ b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm @@ -272,4 +272,12 @@ sub add_extra_area_types { sub is_two_tier { 1 } +sub should_skip_sending_update { + my ($self, $update ) = @_; + + # Bucks don't want to receive updates into Confirm that were made by anyone + # except the original problem reporter. + return $update->user_id != $update->problem->user_id; +} + 1; |