aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Admin.pm
diff options
context:
space:
mode:
authorJon Kristensen <info@jonkri.com>2014-05-15 17:41:07 +0200
committerJon Kristensen <info@jonkri.com>2014-05-15 17:41:07 +0200
commitd6ab834a8e1fb67800785eb781e4f9ecc2e39a5c (patch)
tree57330eaed413dd8a200e2d49b1deb91b69dad79f /perllib/FixMyStreet/App/Controller/Admin.pm
parent87b7c87e1cf83ba043a0254008248595363906c1 (diff)
parent966a1a754d7f4f055944212c5523798a7795402f (diff)
Merge branch 'master' of git://github.com/mysociety/fixmystreet into jonkri-master
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm11
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>';