aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Admin.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-11-20 15:23:03 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-11-20 15:23:03 +0000
commit68170b7e923f6514987562a0eccdc8e494a2729b (patch)
treed40bd273f8de541d44ea44976d2fc3914076ea4a /perllib/FixMyStreet/App/Controller/Admin.pm
parentf9d1c8507e0d5b6fd650b40595f5ba045ce8a338 (diff)
Remove cached photos if hidden in admin interface.
Use the internal hash URL of the photo so that it can still be seen in the admin interface.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm10
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>';