Permalink
Browse files

Update shortcircuit admin search too.

  • Loading branch information...
dracos committed Apr 20, 2012
1 parent 74b1a2f commit 1fc50dcc7f65ae04055a803579445a9397e3ffdf
Showing with 23 additions and 9 deletions.
  1. +23 −9 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/ ],

0 comments on commit 1fc50dc

Please sign in to comment.