diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-01-29 15:21:00 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-01-29 15:24:28 +0000 |
commit | fe26614bc604bcb7111b075381fc1e4992764306 (patch) | |
tree | 5fad9523858f588c5869a5b32507acd3751fe4fb | |
parent | 7cb9ebe6fdc2b41911bc37e4f1c1c346b2ff4ec2 (diff) |
Allow searching for <email> in admin.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 63d0e1933..b5a996bea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Include moderation history in report updates. #2379 - Allow moderation to potentially change state. #2381 - Spot moderation conflicts and raise an error. #2384 + - Allow searching for <email> in admin. - Bugfixes - Check cached reports do still have photos before being shown. #2374 - Delete cache photos upon photo moderation. #2374 diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 188d8c98c..acd6ddbf2 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -684,6 +684,14 @@ sub reports : Path('reports') { if (my $search = $c->get_param('search')) { $search = $self->trim($search); + + # In case an email address, wrapped in <...> + if ($search =~ /^<(.*)>$/) { + my $possible_email = $1; + my $parsed = FixMyStreet::SMS->parse_username($possible_email); + $search = $possible_email if $parsed->{email}; + } + $c->stash->{searched} = $search; my $search_n = 0; @@ -1289,6 +1297,7 @@ sub users: Path('users') : Args(0) { if (my $search = $c->get_param('search')) { $search = $self->trim($search); + $search =~ s/^<(.*)>$/$1/; # In case email wrapped in <...> $c->stash->{searched} = $search; my $isearch = '%' . $search . '%'; |