aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-05-02 10:54:46 +0100
committerMatthew Somerville <matthew@mysociety.org>2012-05-02 10:54:46 +0100
commit12e3f1a37bc13d4f9a85e5a0eea9cb79e5b1ac9c (patch)
tree07dbd6504b2d98fcb8e5c718ca273cb4836c0d94 /perllib
parent4105b3b68b07d99497e731e4fc477a93313da19d (diff)
Fix bug in admin user search, and add council ID search.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm11
1 files changed, 9 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index acdaf7c04..55372afb5 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -483,6 +483,10 @@ sub search_reports : Path('search_reports') {
$query = [
'me.id' => int($1),
];
+ } elsif ($search =~ /^area:(\d+)$/) {
+ $query = [
+ 'me.areas' => { like => ",$1," }
+ ];
} else {
$query = [
'me.id' => $search_n,
@@ -523,6 +527,8 @@ sub search_reports : Path('search_reports') {
'problem.id' => int($1),
%{ $site_restriction },
];
+ } elsif ($search =~ /^area:(\d+)$/) {
+ $query = [];
} else {
$query = [
'me.id' => $search_n,
@@ -534,7 +540,8 @@ sub search_reports : Path('search_reports') {
%{ $site_restriction },
];
}
- my $updates = $c->model('DB::Comment')->search(
+ my $updates;
+ $updates = $c->model('DB::Comment')->search(
{
-or => $query,
},
@@ -543,7 +550,7 @@ sub search_reports : Path('search_reports') {
prefetch => [qw/user problem/],
order_by => [\"(me.state='hidden')",\"(problem.state='hidden')",'me.created']
}
- );
+ ) if @$query;
$c->stash->{updates} = [ $updates->all ];