diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-01-24 21:12:56 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-01-31 11:18:54 +0000 |
commit | 604873e402188986f9662aad5ab6d3fec989274f (patch) | |
tree | 4ad5ba569b5e0e97fa40fdc34d70ff755ffa90fb /t/app/controller/admin.t | |
parent | 7c49ea4a87bb8b98f1c14e28dc4859c05205f9b7 (diff) |
Admin ability to hide a user's reports/updates.
Diffstat (limited to 't/app/controller/admin.t')
-rw-r--r-- | t/app/controller/admin.t | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index bebbb7806..91a28a5fc 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -1051,7 +1051,7 @@ subtest 'editing update email creates new user if required' => sub { my $fields = { text => 'this is a changed update', - state => 'hidden', + state => 'confirmed', name => 'A User', anonymous => 0, username => 'test4@example.com', @@ -1153,6 +1153,7 @@ subtest 'hiding comment marked as fixed reopens report' => sub { $log_entries->delete; subtest 'report search' => sub { + $update->discard_changes; $update->state('confirmed'); $update->user($report->user); $update->update; @@ -1568,6 +1569,18 @@ subtest "Anonymizing user from admin" => sub { is $c, $count_u; }; +subtest "Hiding user's reports from admin" => sub { + my $user = $mech->create_user_ok('existing@example.com', name => 'Existing User'); + my $count_p = FixMyStreet::DB->resultset('Problem')->search({ user_id => $user->id })->count; + my $count_u = FixMyStreet::DB->resultset('Comment')->search({ user_id => $user->id })->count; + $mech->get_ok( '/admin/user_edit/' . $user->id ); + $mech->submit_form_ok({ button => 'hide_everywhere' }); + my $c = FixMyStreet::DB->resultset('Problem')->search({ user_id => $user->id, state => 'hidden' })->count; + is $c, $count_p; + $c = FixMyStreet::DB->resultset('Comment')->search({ user_id => $user->id, state => 'hidden' })->count; + is $c, $count_u; +}; + subtest "Test setting a report from unconfirmed to something else doesn't cause a front end error" => sub { $report->update( { confirmed => undef, state => 'unconfirmed', non_public => 0 } ); $mech->get_ok("/admin/report_edit/$report_id"); |