aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm10
-rw-r--r--templates/web/default/admin/report_edit.html7
-rw-r--r--templates/web/default/admin/update_edit.html7
3 files changed, 21 insertions, 3 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>';
diff --git a/templates/web/default/admin/report_edit.html b/templates/web/default/admin/report_edit.html
index db9ca7317..12560fdf3 100644
--- a/templates/web/default/admin/report_edit.html
+++ b/templates/web/default/admin/report_edit.html
@@ -80,7 +80,12 @@
[% IF problem.photo %]
[% photo = problem.get_photo_params %]
-<li><img alt="" height="[% photo.height %]" width="[% photo.width %]" src="[% c.cobrand.base_url %][% photo.url %]">
+<li><img alt="Photo of this report" height="[% photo.height %]" width="[% photo.width %]" src="[% c.cobrand.base_url %]
+ [%~ IF problem.photo.length == 40 ~%]
+ /photo/[% problem.photo %].temp.jpeg
+ [%~ ELSE ~%]
+ [% photo.url %]
+ [%~ END %]">
<br>
<input type="submit" name="rotate_photo" value="[% loc('Rotate Left') %]">
<input type="submit" name="rotate_photo" value="[% loc('Rotate Right') %]">
diff --git a/templates/web/default/admin/update_edit.html b/templates/web/default/admin/update_edit.html
index 0f69a78fa..5ffce8bc4 100644
--- a/templates/web/default/admin/update_edit.html
+++ b/templates/web/default/admin/update_edit.html
@@ -52,7 +52,12 @@
[% IF update.photo %]
[% photo = update.get_photo_params %]
-<li><img alt="" height="[% photo.height %]" width="[% photo.width %]" src="[% photo.url %]">
+<li><img alt="Photo of this update" height="[% photo.height %]" width="[% photo.width %]" src="[% c.cobrand.base_url %]
+ [%~ IF update.photo.length == 40 ~%]
+ /photo/[% update.photo %].temp.jpeg
+ [%~ ELSE ~%]
+ [% photo.url %]
+ [%~ END ~%]">
<input type="checkbox" id="remove_photo" name="remove_photo" value="1">
<label for="remove_photo" class="inline">[% loc("Remove photo (can't be undone!)") %]</label></li>
[% END %]