diff options
Diffstat (limited to 'perllib/FixMyStreet/DB/ResultSet/Problem.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Problem.pm | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index 97d457297..5499af474 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -216,6 +216,11 @@ sub categories_summary { return \%categories; } +sub get_admin_url { + my ($rs, $cobrand, $row) = @_; + return $cobrand->admin_base_url . '/report_edit/' . $row->id; +} + sub send_reports { my ( $rs, $site_override ) = @_; @@ -259,10 +264,14 @@ sub send_reports { } $cobrand->set_lang_and_domain($row->lang, 1); - if ( $row->is_from_abuser ) { + if ( $row->is_from_abuser) { $row->update( { state => 'hidden' } ); debug_print("hiding because its sender is flagged as an abuser", $row->id) if $debug_mode; next; + } elsif ( $row->title =~ /app store test/i ) { + $row->update( { state => 'hidden' } ); + debug_print("hiding because it is an app store test message", $row->id) if $debug_mode; + next; } # Template variables for the email @@ -274,7 +283,7 @@ sub send_reports { $h{query} = $row->postcode; $h{url} = $email_base_url . $row->url; - $h{admin_url} = $cobrand->admin_base_url . 'report_edit/' . $row->id; + $h{admin_url} = $rs->get_admin_url($cobrand, $row); $h{phone_line} = $h{phone} ? _('Phone:') . " $h{phone}\n\n" : ''; if ($row->photo) { $h{has_photo} = _("This web page also contains a photo of the problem, provided by the user.") . "\n\n"; @@ -331,7 +340,10 @@ sub send_reports { # XXX Only copes with at most one missing body my ($bodies, $missing) = $row->bodies_str =~ /^([\d,]+)(?:\|(\d+))?/; my @bodies = split(/,/, $bodies); - $bodies = FixMyStreet::App->model("DB::Body")->search({ id => \@bodies }); + $bodies = FixMyStreet::App->model("DB::Body")->search( + { id => \@bodies }, + { order_by => 'name' }, + ); $missing = FixMyStreet::App->model("DB::Body")->find($missing) if $missing; my @dear; |