aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/DB')
-rw-r--r--perllib/FixMyStreet/DB/Result/Comment.pm20
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm10
2 files changed, 25 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm
index b4e42b456..d27c5ea8c 100644
--- a/perllib/FixMyStreet/DB/Result/Comment.pm
+++ b/perllib/FixMyStreet/DB/Result/Comment.pm
@@ -115,6 +115,26 @@ my $stz = sub {
around created => $stz;
around confirmed => $stz;
+=head2 get_cobrand_logged
+
+Get a cobrand object for the cobrand the update was made on.
+
+e.g. if an update was logged at www.fixmystreet.com, this will be a
+FixMyStreet::Cobrand::FixMyStreet object.
+
+=cut
+
+has get_cobrand_logged => (
+ is => 'ro',
+ lazy => 1,
+ default => sub {
+ my $self = shift;
+ my $cobrand_class = FixMyStreet::Cobrand->get_class_for_moniker( $self->cobrand );
+ return $cobrand_class->new;
+ },
+);
+
+
# You can replace this text with custom code or comments, and it will be preserved on regeneration
sub check_for_errors {
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 76a6f72fb..2192158d3 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -780,7 +780,7 @@ sub duration_string {
sub local_coords {
my $self = shift;
- my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($self->cobrand)->new;
+ my $cobrand = $self->get_cobrand_logged;
if ($cobrand->moniker eq 'zurich') {
my ($x, $y) = Geo::Coordinates::CH1903Plus::from_latlon($self->latitude, $self->longitude);
return ( int($x+0.5), int($y+0.5) );
@@ -896,8 +896,9 @@ sub updates_sent_to_body {
return unless $self->send_method_used && $self->send_method_used eq 'Open311';
# Some bodies only send updates *to* FMS, they don't receive updates.
- # NB See also the list in bin/send-comments
- my $excluded = qr{Lewisham|Oxfordshire};
+ my $cobrand = $self->get_cobrand_logged;
+ my $handler = $cobrand->call_hook(get_body_handler_for_problem => $self);
+ return 0 if $handler && $handler->call_hook('open311_post_update_skip');
my @bodies = values %{ $self->bodies };
my @updates_sent = grep {
@@ -905,8 +906,7 @@ sub updates_sent_to_body {
(
$_->send_method eq 'Open311' ||
$_->send_method eq 'Noop' # Sending might be temporarily disabled
- ) &&
- !($_->name =~ /$excluded/)
+ )
} @bodies;
return scalar @updates_sent;
}