diff options
-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 . '%'; |