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 /bin/send-comments | |
parent | b890d9779a53fb0cd07c10f2e19728b57700931f (diff) |
[Buckinghamshire] Don’t send updates not made by original reporter
Diffstat (limited to 'bin/send-comments')
-rwxr-xr-x | bin/send-comments | 13 |
1 files changed, 12 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 |