aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Admin.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm49
1 files changed, 22 insertions, 27 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index b53b6ab06..4999d16f2 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -739,8 +739,24 @@ sub search_users: Path('search_users') : Args(0) {
]
}
);
+ my @users = $users->all;
+ my %email2user = map { $_->email => $_ } @users;
+ $c->stash->{users} = [ @users ];
+
+ my $emails = $c->model('DB::Abuse')->search(
+ {
+ email => { ilike => $isearch }
+ }
+ );
+ foreach my $email ($emails->all) {
+ # Slight abuse of the boolean flagged value
+ if ($email2user{$email->email}) {
+ $email2user{$email->email}->flagged( 2 );
+ } else {
+ push @{$c->stash->{users}}, { email => $email->email, flagged => 2 };
+ }
+ }
- $c->stash->{users} = [ $users->all ];
}
return 1;
@@ -847,26 +863,6 @@ sub update_edit : Path('update_edit') : Args(1) {
return 1;
}
-sub search_abuse : Path('search_abuse') : Args(0) {
- my ( $self, $c ) = @_;
-
- $c->forward('check_page_allowed');
-
- my $search = $c->req->param('search');
-
- if ($search) {
- my $emails = $c->model('DB::Abuse')->search(
- {
- email => { ilike => "\%$search\%" }
- }
- );
-
- $c->stash->{emails} = [ $emails->all ];
- }
-
- return 1;
-}
-
sub user_edit : Path('user_edit') : Args(1) {
my ( $self, $c, $id ) = @_;
@@ -1033,13 +1029,12 @@ sub set_allowed_pages : Private {
if( !$pages ) {
$pages = {
'summary' => [_('Summary'), 0],
- 'council_list' => [_('Council contacts'), 1],
- 'search_reports' => [_('Search Reports'), 2],
+ 'council_list' => [_('Bodies'), 1],
+ 'search_reports' => [_('Reports'), 2],
'timeline' => [_('Timeline'), 3],
- 'questionnaire' => [_('Survey Results'), 4],
- 'search_users' => [_('Search Users'), 5],
- 'search_abuse' => [_('Search Abuse'), 5],
- 'list_flagged' => [_('List Flagged'), 6],
+ 'questionnaire' => [_('Survey'), 4],
+ 'search_users' => [_('Users'), 5],
+ 'list_flagged' => [_('Flagged'), 6],
'stats' => [_('Stats'), 6],
'user_edit' => [undef, undef],
'council_contacts' => [undef, undef],