diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 64b38d99f..9c0018f38 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -770,9 +770,13 @@ sub report_edit : Path('report_edit') : Args(1) { $problem->user( $user ); } + # Deal with photos if ( $c->req->param('remove_photo') ) { $problem->photo(undef); } + if ( $new_state eq 'hidden' ) { + unlink glob FixMyStreet->path_to( 'web', 'photo', $problem->id . '.*' ); + } if ( $problem->is_visible() and $old_state eq 'unconfirmed' ) { $problem->confirmed( \'ms_current_timestamp()' ); @@ -915,7 +919,7 @@ sub update_edit : Path('update_edit') : Args(1) { $update->name( $c->req->param('name') || '' ); $update->text( $c->req->param('text') ); $update->anonymous( $c->req->param('anonymous') ); - $update->state( $c->req->param('state') ); + $update->state( $new_state ); if ( $c->req->param('email') ne $update->user->email ) { my $user = @@ -935,6 +939,10 @@ sub update_edit : Path('update_edit') : Args(1) { } } + if ( $new_state eq 'hidden' ) { + unlink glob FixMyStreet->path_to( 'web', 'photo', 'c', $update->id . '.*' ); + } + $update->update; $c->stash->{status_message} = '<p><em>' . _('Updated!') . '</em></p>'; |