diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Photo.pm | 17 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 2 | ||||
-rwxr-xr-x | templates/web/emptyhomes/reports/index.html | 8 | ||||
-rwxr-xr-x | templates/web/fiksgatami/reports/index.html | 10 |
4 files changed, 23 insertions, 14 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Photo.pm b/perllib/FixMyStreet/App/Controller/Photo.pm index ac0c891d4..17862aa0a 100644 --- a/perllib/FixMyStreet/App/Controller/Photo.pm +++ b/perllib/FixMyStreet/App/Controller/Photo.pm @@ -30,8 +30,7 @@ sub index :Path :Args(0) { my $id = $c->req->param('id'); my $comment = $c->req->param('c'); - $c->detach( '/page_error_404_not_found', [ 'No photo' ] ) - unless $id || $comment; + $c->detach( 'no_photo' ) unless $id || $comment; my @photo; if ( $comment ) { @@ -41,6 +40,12 @@ sub index :Path :Args(0) { photo => { '!=', undef }, } ); } else { + # GoogleBot-Image is doing this for some reason? + if ( $id =~ m{ ^(\d+) \D .* $ }x ) { + return $c->res->redirect( $c->uri_with( { id => $1 } ), 301 ); + } + + $c->detach( 'no_photo' ) if $id =~ /\D/; @photo = $c->cobrand->problems->search( { id => $id, state => [ 'confirmed', 'fixed', 'partial' ], @@ -48,8 +53,7 @@ sub index :Path :Args(0) { } ); } - $c->detach( '/page_error_404_not_found', [ 'No photo' ] ) - unless @photo; + $c->detach( 'no_photo' ) unless @photo; my $photo = $photo[0]->photo; if ( $c->req->param('tn' ) ) { @@ -66,6 +70,11 @@ sub index :Path :Args(0) { $c->res->body( $photo ); } +sub no_photo : Private { + my ( $self, $c ) = @_; + $c->detach( '/page_error_404_not_found', [ 'No photo' ] ); +} + sub _resize { my ($photo, $size) = @_; use Image::Magick; diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 497ec784a..f732b94f1 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -66,7 +66,7 @@ sub load_problem_or_display_error : Private { : $c->cobrand->problems->find( { id => $id } ); # check that the problem is suitable to show. - if ( !$problem || $problem->state eq 'unconfirmed' ) { + if ( !$problem || $problem->state eq 'unconfirmed' || $problem->state eq 'partial' ) { $c->detach( '/page_error_404_not_found', [ _('Unknown problem ID') ] ); } elsif ( $problem->state eq 'hidden' ) { diff --git a/templates/web/emptyhomes/reports/index.html b/templates/web/emptyhomes/reports/index.html index 003954f19..f2cd99cdb 100755 --- a/templates/web/emptyhomes/reports/index.html +++ b/templates/web/emptyhomes/reports/index.html @@ -21,10 +21,10 @@ [%- END -%] > <td align="left"><a href="[% area.url %]">[% area.name %]</a></td> -<td>[% open.${area.id}.new.size or 0 %]</td> -<td>[% (open.${area.id}.older.size or 0) + (open.${area.id}.unknown.size or 0) %]</td> -<td>[% fixed.${area.id}.new.size or 0 %]</td> -<td>[% fixed.${area.id}.old.size or 0 %]</td> +<td>[% open.${area.id}.new or 0 %]</td> +<td>[% (open.${area.id}.older or 0) + (open.${area.id}.unknown or 0) %]</td> +<td>[% fixed.${area.id}.new or 0 %]</td> +<td>[% fixed.${area.id}.old or 0 %]</td> </tr> [% END %] </table> diff --git a/templates/web/fiksgatami/reports/index.html b/templates/web/fiksgatami/reports/index.html index ab8ff6381..3cbb2bf8d 100755 --- a/templates/web/fiksgatami/reports/index.html +++ b/templates/web/fiksgatami/reports/index.html @@ -21,11 +21,11 @@ [%- END -%] > <td align="left"><a href="[% area.url %]">[% area.name %]</a></td> -<td>[% open.${area.id}.new.size or 0 %]</td> -<td>[% open.${area.id}.older.size or 0 %]</td> -<td>[% open.${area.id}.unknown.size or 0 %]</td> -<td>[% fixed.${area.id}.new.size or 0 %]</td> -<td>[% fixed.${area.id}.old.size or 0 %]</td> +<td>[% open.${area.id}.new or 0 %]</td> +<td>[% open.${area.id}.older or 0 %]</td> +<td>[% open.${area.id}.unknown or 0 %]</td> +<td>[% fixed.${area.id}.new or 0 %]</td> +<td>[% fixed.${area.id}.old or 0 %]</td> </tr> [% END %] </table> |