aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/SendReport/Email/TfL.pm23
1 files changed, 23 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/SendReport/Email/TfL.pm b/perllib/FixMyStreet/SendReport/Email/TfL.pm
new file mode 100644
index 000000000..801489c62
--- /dev/null
+++ b/perllib/FixMyStreet/SendReport/Email/TfL.pm
@@ -0,0 +1,23 @@
+package FixMyStreet::SendReport::Email::TfL;
+
+use Moo;
+extends 'FixMyStreet::SendReport::Email';
+
+sub build_recipient_list {
+ my ( $self, $row, $h ) = @_;
+
+ return unless @{$self->bodies} == 1;
+ my $body = $self->bodies->[0];
+
+ # We don't care what the category was, look up the Traffic lights contact
+ my $contact = $row->result_source->schema->resultset("Contact")->not_deleted->find({
+ body_id => $body->id,
+ category => 'Traffic lights',
+ });
+ return unless $contact;
+
+ @{$self->to} = map { [ $_, $body->name ] } split /,/, $contact->email;
+ return 1;
+}
+
+1;