diff options
Diffstat (limited to 'perllib/FixMyStreet/SendReport/Email.pm')
-rw-r--r-- | perllib/FixMyStreet/SendReport/Email.pm | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/perllib/FixMyStreet/SendReport/Email.pm b/perllib/FixMyStreet/SendReport/Email.pm index bac408510..4d2c8bb17 100644 --- a/perllib/FixMyStreet/SendReport/Email.pm +++ b/perllib/FixMyStreet/SendReport/Email.pm @@ -1,6 +1,6 @@ package FixMyStreet::SendReport::Email; -use Moose; +use Moo; use FixMyStreet::Email; BEGIN { extends 'FixMyStreet::SendReport'; } @@ -11,7 +11,7 @@ sub build_recipient_list { my $all_confirmed = 1; foreach my $body ( @{ $self->bodies } ) { - my $contact = FixMyStreet::App->model("DB::Contact")->find( { + my $contact = $row->result_source->schema->resultset("Contact")->find( { deleted => 0, body_id => $body->id, category => $row->category @@ -75,7 +75,7 @@ sub send { my $recips = $self->build_recipient_list( $row, $h ); # on a staging server send emails to ourselves rather than the bodies - if (mySociety::Config::get('STAGING_SITE') && !mySociety::Config::get('SEND_REPORTS_ON_STAGING') && !FixMyStreet->test_mode) { + if (FixMyStreet->config('STAGING_SITE') && !FixMyStreet->config('SEND_REPORTS_ON_STAGING') && !FixMyStreet->test_mode) { $recips = 1; @{$self->to} = [ $row->user->email, $self->to->[0][1] || $row->name ]; } @@ -94,20 +94,19 @@ sub send { From => $self->send_from( $row ), }; - my $app = FixMyStreet::App->new( cobrand => $cobrand ); - - $cobrand->munge_sendreport_params($app, $row, $h, $params) if $cobrand->can('munge_sendreport_params'); + $cobrand->munge_sendreport_params($row, $h, $params) if $cobrand->can('munge_sendreport_params'); $params->{Bcc} = $self->bcc if @{$self->bcc}; if (FixMyStreet::Email::test_dmarc($params->{From}[0])) { $params->{'Reply-To'} = [ $params->{From} ]; - $params->{From} = [ mySociety::Config::get('CONTACT_EMAIL'), $params->{From}[1] ]; + $params->{From} = [ FixMyStreet->config('CONTACT_EMAIL'), $params->{From}[1] ]; } - my $result = $app->send_email_cron( + my $result = FixMyStreet::Email::send_cron( + $row->result_source->schema, $params, - mySociety::Config::get('CONTACT_EMAIL'), + FixMyStreet->config('CONTACT_EMAIL'), $nomail, $cobrand ); |