diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 9c0018f38..cfe165f43 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -774,7 +774,8 @@ sub report_edit : Path('report_edit') : Args(1) { if ( $c->req->param('remove_photo') ) { $problem->photo(undef); } - if ( $new_state eq 'hidden' ) { + + if ( $c->req->param('remove_photo') || $new_state eq 'hidden' ) { unlink glob FixMyStreet->path_to( 'web', 'photo', $problem->id . '.*' ); } @@ -916,6 +917,10 @@ sub update_edit : Path('update_edit') : Args(1) { $update->photo(undef); } + if ( $c->req->param('remove_photo') || $new_state eq 'hidden' ) { + unlink glob FixMyStreet->path_to( 'web', 'photo', 'c', $update->id . '.*' ); + } + $update->name( $c->req->param('name') || '' ); $update->text( $c->req->param('text') ); $update->anonymous( $c->req->param('anonymous') ); @@ -939,10 +944,6 @@ 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>'; |