diff options
author | Zarino Zappia <mail@zarino.co.uk> | 2019-08-22 10:55:20 +0100 |
---|---|---|
committer | Zarino Zappia <mail@zarino.co.uk> | 2019-08-23 10:38:29 +0100 |
commit | 3c73315e3b6a9d403b008bb06a6497224f2486c4 (patch) | |
tree | c477c26e2602c97c156bc154e85a67f1d47dbbd6 /perllib/FixMyStreet/App/Controller/Contact.pm | |
parent | 3c4d48f5fd5f499736f07ac2a5d17c1d4bab6c14 (diff) |
$user->latest_visible_problem() convenience method
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Contact.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Contact.pm | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm index 90ea18ca2..c8cd14907 100644 --- a/perllib/FixMyStreet/App/Controller/Contact.pm +++ b/perllib/FixMyStreet/App/Controller/Contact.pm @@ -202,11 +202,7 @@ sub prepare_params_for_email : Private { $c->stash->{user_admin_url} = $admin_url . '/users/' . $user->id; $c->stash->{user_reports_admin_url} = $admin_url . '/reports?search=' . $user->email; - my $user_latest_problem = $user->problems->search({ - state => [ FixMyStreet::DB::Result::Problem->visible_states() ] - }, { - order_by => { -desc => 'id' } - })->single; + my $user_latest_problem = $user->latest_visible_problem(); if ( $user_latest_problem) { $c->stash->{user_latest_report_admin_url} = $admin_url . '/report_edit/' . $user_latest_problem->id; } |