aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm25
-rw-r--r--t/app/controller/admin.t12
-rw-r--r--templates/web/default/admin/list_flagged.html79
3 files changed, 112 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index e1ced4a25..de90321a0 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -715,6 +715,22 @@ sub search_abuse : Path('search_abuse') : Args(0) {
return 1;
}
+sub list_flagged : Path('list_flagged') : Args(0) {
+ my ( $self, $c ) = @_;
+
+ $c->forward('set_allowed_pages');
+
+ my $problems = $c->model('DB::Problem')->search( { flagged => 1 } );
+
+ $c->stash->{problems} = $problems;
+
+ my $users = $c->model('DB::User')->search( { flagged => 1 } );
+
+ $c->stash->{users} = $users;
+
+ return 1;
+}
+
=head2 set_allowed_pages
Sets up the allowed_pages stash entry for checking if the current page is
@@ -735,10 +751,11 @@ sub set_allowed_pages : Private {
'timeline' => [_('Timeline'), 3],
'questionnaire' => [_('Survey Results'), 4],
'search_abuse' => [_('Search Abuse'), 5],
- 'council_contacts' => [undef, undef],
- 'council_edit' => [undef, undef],
- 'report_edit' => [undef, undef],
- 'update_edit' => [undef, undef],
+ 'list_flagged' => [_('List Flagged'), 6],
+ 'council_contacts' => [undef, undef],
+ 'council_edit' => [undef, undef],
+ 'report_edit' => [undef, undef],
+ 'update_edit' => [undef, undef],
'abuse_edit' => [undef, undef],
}
}
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t
index acbe17c1b..2740a1dbb 100644
--- a/t/app/controller/admin.t
+++ b/t/app/controller/admin.t
@@ -772,6 +772,18 @@ subtest 'search abuse' => sub {
$mech->content_contains('test4@example.com');
};
+subtest 'show flagged entries' => sub {
+ $report->flagged( 1 );
+ $report->update;
+
+ $user->flagged( 1 );
+ $user->update;
+
+ $mech->get_ok('/admin/list_flagged');
+ $mech->content_contains( $report->title );
+ $mech->content_contains( $user->email );
+};
+
$mech->delete_user( $user );
$mech->delete_user( $user2 );
$mech->delete_user( $user3 );
diff --git a/templates/web/default/admin/list_flagged.html b/templates/web/default/admin/list_flagged.html
new file mode 100644
index 000000000..6a4252abf
--- /dev/null
+++ b/templates/web/default/admin/list_flagged.html
@@ -0,0 +1,79 @@
+[% INCLUDE 'admin/header.html' title=loc('Search Reports') %]
+[% PROCESS 'admin/report_blocks.html' %]
+
+
+<h2>[% loc( 'Problems' ) %]</h2>
+[% IF problems %]
+<table cellspacing="0" cellpadding="2" border="1">
+ <tr>
+ <th>[% loc('ID') %]</th>
+ <th>[% loc('Title') %]</th>
+ <th>[% loc('Name') %]</th>
+ <th>[% loc('Email') %]</th>
+ <th>[% loc('Council') %]</th>
+ <th>[% loc('Category') %]</th>
+ <th>[% loc('Anonymous') %]</th>
+ <th>[% loc('Cobrand') %]</th>
+ <th>[% loc('Created') %]</th>
+ <th>[% loc('State') %]</th>
+ <th>[% loc('When sent') %]</th>
+ <th>*</th>
+ </tr>
+[%- WHILE ( problem = problems.next ) %]
+ <tr[% ' class="hidden"' IF problem.state == 'hidden' %]>
+ <td>[%- IF problem.state == 'confirmed' || problem.state == 'fixed' -%]
+ [%- cobrand_data = problem.cobrand_data %]
+ [%- cobrand_data = c.data_for_generic_problem IF !problem.cobrand %]
+ <a href="[% c.uri_for_email( '/report', problem.id, cobrand_data ) %]">[% problem.id %]</a>
+ [%- ELSE %]
+ [%- problem.id %]
+ [%- END -%]</td>
+ <td>[% PROCESS value_or_nbsp value=problem.title %]</td>
+ <td>[% PROCESS value_or_nbsp value=problem.name %]</td>
+ <td>[% PROCESS value_or_nbsp value=problem.user.email %]</td>
+ <td>[%- IF edit_council_contacts -%]
+ <a href="[% c.uri_for('council_contacts', problem.council ) %]">[% PROCESS value_or_nbsp value=problem.council %]</a>
+ [%- ELSE -%]
+ [%- PROCESS value_or_nbsp value=problem.council -%]
+ [%- END -%]</td>
+ <td>[% PROCESS value_or_nbsp value=problem.category %]</td>
+ <td>[% IF problem.anonymous %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td>
+ <td>[% problem.cobrand %]<br>[% problem.cobrand_data | html %]</td>
+ <td>[% PROCESS format_time time=problem.created %]</td>
+ <td>[% problem.state %]<small>
+ [%- IF problem.state == 'fixed' || problem.state == 'confirmed' %]<br>[% loc('Confirmed:' ) %]&nbsp;[% PROCESS format_time time=problem.confirmed %][% END -%]
+ [%- IF problem.state == 'fixed' %]<br>[% loc('Fixed:') %] [% PROCESS format_time time=problem.lastupdate %][% END -%]
+ [%- IF problem.state == 'confirmed' %]<br>[% loc('Last&nbsp;update:') %] [% PROCESS format_time time=problem.lastupdate %][% END -%]</small>
+ </td>
+ <td>[% PROCESS format_time time=problem.whensent %]</td>
+ <td><a href="[% c.uri_for( 'report_edit', problem.id ) %]">[% loc('Edit') %]</a></td>
+ </tr>
+[%- END -%]
+</table>
+[% ELSE %]
+<p>
+[% loc('No flagged problems found') %]
+</p>
+[% END %]
+
+<h2>[% loc( 'Users' ) %]</h2>
+[% IF users%]
+<table cellspacing="0" cellpadding="2" border="1">
+ <tr>
+ <th>[% loc('Name') %]</th>
+ <th>[% loc('Email') %]</th>
+ </tr>
+[% WHILE ( user = users.next ) -%]
+ <tr>
+ <td>[% user.name | html %]</td>
+ <td>[% user.email | html %]</td>
+ </tr>
+[%- END %]
+</table>
+[%- ELSE %]
+<p>
+[% loc('No flagged users found') %]
+</p>
+[%- END %]
+
+[% INCLUDE 'admin/footer.html' %]