aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2014-04-17 13:12:20 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2014-04-17 13:12:20 +0100
commit62464f61cc5d2aed19ef98d3bb31427feef8fa49 (patch)
tree1a1977cb75471cb1e26708d3396b6a148bcf1053 /perllib
parent7b216839fa1d74045009bd06e6414f6c9f213a22 (diff)
Also remove cached file when photo removed.
Diffstat (limited to 'perllib')
-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>';