diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-06-17 16:57:01 +0100 |
---|---|---|
committer | M Somerville <matthew-github@dracos.co.uk> | 2020-11-11 10:29:20 +0000 |
commit | ac82484fb2e2acc95012d8ba0894b1165743b8ea (patch) | |
tree | e97dc6e377c6d5b4dee5bd05bf46ad6e00b6152f /perllib | |
parent | 6337ebfd91a87eaf5efa077c5f9a9eff286c1f76 (diff) |
[Bromley] Send sent confirmation for waste reports
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bromley.pm | 8 | ||||
-rw-r--r-- | perllib/FixMyStreet/Queue/Item/Report.pm | 2 |
3 files changed, 10 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 98ebd4972..f64a109e8 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -1676,7 +1676,7 @@ sub redirect_or_confirm_creation : Private { $c->forward( 'create_related_things' ); if ($c->stash->{contributing_as_another_user} && $report->user->email && $report->user->id != $c->user->id - && !$c->cobrand->report_sent_confirmation_email) { + && !$c->cobrand->report_sent_confirmation_email($report)) { $c->send_email( 'other-reported.txt', { to => [ [ $report->user->email, $report->name ] ], } ); diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm index 176762323..5fc03eb81 100644 --- a/perllib/FixMyStreet/Cobrand/Bromley.pm +++ b/perllib/FixMyStreet/Cobrand/Bromley.pm @@ -379,6 +379,14 @@ sub munge_load_and_group_problems { } } +# We want to send confirmation emails only for Waste reports +sub report_sent_confirmation_email { + my ($self, $report) = @_; + my $contact = $report->contact or return; + return 'id' if grep { $_ eq 'Waste' } @{$report->contact->groups}; + return ''; +} + sub munge_around_category_where { my ($self, $where) = @_; $where->{extra} = [ undef, { -not_like => '%Waste%' } ]; diff --git a/perllib/FixMyStreet/Queue/Item/Report.pm b/perllib/FixMyStreet/Queue/Item/Report.pm index 60e9ad3dc..070b244bb 100644 --- a/perllib/FixMyStreet/Queue/Item/Report.pm +++ b/perllib/FixMyStreet/Queue/Item/Report.pm @@ -243,7 +243,7 @@ sub _send { sub _post_send { my ($self, $result) = @_; - my $send_confirmation_email = $self->cobrand_handler->report_sent_confirmation_email; + my $send_confirmation_email = $self->cobrand_handler->report_sent_confirmation_email($self->report); unless ($result) { $self->report->update( { whensent => \'current_timestamp', |