Skip to content

Commit

Permalink
[Bexley][WW] Don't show 'State changed to' in request update emails
Browse files Browse the repository at this point in the history
  • Loading branch information
nephila-nacrea committed Nov 27, 2024
1 parent 3d020a3 commit d25fae1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
14 changes: 14 additions & 0 deletions perllib/FixMyStreet/Cobrand/Bexley.pm
Original file line number Diff line number Diff line change
Expand Up @@ -450,4 +450,18 @@ sub waste_auto_confirm_report {
|| $report->category eq 'Request container removal';
}

=head2 skip_alert_state_changed_to
Bin request update/completion emails sent to user do not have a
'State changed to:' line
=cut

sub skip_alert_state_changed_to {
my ( $self, $report ) = @_;

return $report->category eq 'Request new container'
|| $report->category eq 'Request container removal';
}

1;
10 changes: 7 additions & 3 deletions perllib/FixMyStreet/Script/Alerts.pm
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,14 @@ sub send_alert_type {
# this might throw up the odd false positive but only in cases where the
# state has changed and there was already update text
if ($row->{item_problem_state} && $last_problem_state ne $row->{item_problem_state}) {
my $cobrand_name = $report->cobrand_name_for_state($cobrand);
my $state = FixMyStreet::DB->resultset("State")->display($row->{item_problem_state}, 1, $cobrand_name);
my $update = '';
unless ( $cobrand->call_hook( skip_alert_state_changed_to => $report ) ) {
my $cobrand_name = $report->cobrand_name_for_state($cobrand);
my $state = FixMyStreet::DB->resultset("State")->display($row->{item_problem_state}, 1, $cobrand_name);

$update = _('State changed to:') . ' ' . $state;
}

my $update = _('State changed to:') . ' ' . $state;
$row->{item_text_original} = $row->{item_text};
$row->{item_text} = $row->{item_text} ? $row->{item_text} . "\n\n" . $update :
$update;
Expand Down

0 comments on commit d25fae1

Please sign in to comment.