diff options
author | Matthew Somerville <matthew@mysociety.org> | 2011-08-01 14:32:35 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-08-01 14:32:35 +0100 |
commit | 3c9c0531e5332c5375f23e9b37fdeb8e5212f019 (patch) | |
tree | 0ea95606888df97297091af392e272c44439c1e8 | |
parent | 8b2659d593a20db23c0b5f05e9ec8221618d030f (diff) |
Store confirmed time if done via admin interface, fixes #141.
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 4 | ||||
-rw-r--r-- | t/app/controller/admin.t | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 3f2b62f6f..a0d3e8643 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -746,6 +746,10 @@ sub update_edit : Path('update_edit') : Args(1) { $update->user($user); } + if ( $new_state eq 'confirmed' and $old_state eq 'unconfirmed' ) { + $update->confirmed( \'ms_current_timestamp()' ); + } + $update->update; $status_message = '<p><em>' . _('Updated!') . '</em></p>'; diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index 7f8590747..9f698c629 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -602,7 +602,7 @@ for my $test ( }, changes => { text => 'this is a twice changed update', - state => 'hidden', + state => 'confirmed', }, log_count => 7, log_entries => [qw/edit state_change state_change edit edit edit edit/], @@ -629,6 +629,9 @@ for my $test ( $update->discard_changes; is $update->$_, $test->{changes}->{$_} for grep { $_ ne 'email' } keys %{ $test->{changes} }; + if ( $test->{changes}{state} && $test->{changes}{state} eq 'confirmed' ) { + isnt $update->confirmed, undef; + } if ( $test->{user} ) { is $update->user->id, $test->{user}->id, 'update user'; |