aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-04-20 15:48:18 +0100
committerMatthew Somerville <matthew@mysociety.org>2012-04-20 15:48:18 +0100
commit1fc50dcc7f65ae04055a803579445a9397e3ffdf (patch)
treebf1873872cebe0ac0d8405648d034480dbadf26b
parent74b1a2ff2e9fdb7c418bc271ca3306697b3e5ee5 (diff)
Update shortcircuit admin search too.
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm32
1 files changed, 23 insertions, 9 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 8193e40ad..acdaf7c04 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -512,17 +512,31 @@ sub search_reports : Path('search_reports') {
$c->stash->{edit_council_contacts} = 1
if ( grep {$_ eq 'councilcontacts'} keys %{$c->stash->{allowed_pages}});
+ if (is_valid_email($search)) {
+ $query = [
+ 'user.email' => { ilike => $like_search },
+ %{ $site_restriction },
+ ];
+ } elsif ($search =~ /^id:(\d+)$/) {
+ $query = [
+ 'me.id' => int($1),
+ 'problem.id' => int($1),
+ %{ $site_restriction },
+ ];
+ } else {
+ $query = [
+ 'me.id' => $search_n,
+ 'problem.id' => $search_n,
+ 'user.email' => { ilike => $like_search },
+ 'me.name' => { ilike => $like_search },
+ text => { ilike => $like_search },
+ 'me.cobrand_data' => { ilike => $like_search },
+ %{ $site_restriction },
+ ];
+ }
my $updates = $c->model('DB::Comment')->search(
{
- -or => [
- 'me.id' => $search_n,
- 'problem.id' => $search_n,
- 'user.email' => { ilike => $like_search },
- 'me.name' => { ilike => $like_search },
- text => { ilike => $like_search },
- 'me.cobrand_data' => { ilike => $like_search },
- %{ $site_restriction },
- ]
+ -or => $query,
},
{
-select => [ 'me.*', qw/problem.council problem.state/ ],