aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconf/Vagrantfile.example4
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm5
-rw-r--r--t/app/controller/admin.t7
3 files changed, 14 insertions, 2 deletions
diff --git a/conf/Vagrantfile.example b/conf/Vagrantfile.example
index fbc647746..8c2a32c47 100755
--- a/conf/Vagrantfile.example
+++ b/conf/Vagrantfile.example
@@ -36,8 +36,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# We need curl to fetch the install script
apt-get update -qq
apt-get install -qq -y curl >/dev/null
- curl -s https://raw.github.com/mysociety/commonlib/master/bin/install-site.sh | \
- sh -s -- --dev fixmystreet vagrant 127.0.0.1.xip.io
+ curl -s -O https://raw.github.com/mysociety/commonlib/master/bin/install-site.sh
+ sh install-site.sh --dev fixmystreet vagrant 127.0.0.1.xip.io
# Assume a developer will want to run the tests.
# TODO The tests should be further altered to work regardless of
# configuration file settings
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 0c81a8750..07bd61cbb 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -553,10 +553,15 @@ sub reports : Path('reports') {
$query->{'-or'} = [
'me.areas' => { like => "%,$1,%" }
];
+ } elsif ($search =~ /^ref:(\d+)$/) {
+ $query->{'-or'} = [
+ 'me.external_id' => { like => "%$1%" }
+ ];
} else {
$query->{'-or'} = [
'me.id' => $search_n,
'user.email' => { ilike => $like_search },
+ 'me.external_id' => { ilike => $like_search },
'me.name' => { ilike => $like_search },
'me.title' => { ilike => $like_search },
detail => { ilike => $like_search },
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t
index 85f4572fc..a48e2e919 100644
--- a/t/app/controller/admin.t
+++ b/t/app/controller/admin.t
@@ -53,6 +53,7 @@ my $report = FixMyStreet::App->model('DB::Problem')->find_or_create(
used_map => 't',
name => 'Test User',
anonymous => 'f',
+ external_id => '13',
state => 'confirmed',
confirmed => $dt->ymd . ' ' . $dt->hms,
lang => 'en-gb',
@@ -1041,6 +1042,12 @@ subtest 'report search' => sub {
my $r_id = $report->id;
$mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id">$r_id</a>} );
+ $mech->get_ok('/admin/reports?search=' . $report->external_id);
+ $mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id">$r_id</a>} );
+
+ $mech->get_ok('/admin/reports?search=ref:' . $report->external_id);
+ $mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id">$r_id</a>} );
+
$mech->get_ok('/admin/reports?search=' . $report->user->email);
my $u_id = $update->id;