aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Roles/PhotoSet.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/Roles/PhotoSet.pm')
-rw-r--r--perllib/FixMyStreet/Roles/PhotoSet.pm13
1 files changed, 11 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Roles/PhotoSet.pm b/perllib/FixMyStreet/Roles/PhotoSet.pm
index 4a40ef3f9..3d0027f8c 100644
--- a/perllib/FixMyStreet/Roles/PhotoSet.pm
+++ b/perllib/FixMyStreet/Roles/PhotoSet.pm
@@ -31,6 +31,11 @@ sub get_first_image_fp {
return $self->get_photoset->get_image_data( num => 0, size => 'fp' );
}
+sub get_first_image_og {
+ my ($self) = @_;
+ return $self->get_photoset->get_image_data( num => 0, size => 'og' );
+}
+
sub photos {
my $self = shift;
my $photoset = $self->get_photoset;
@@ -38,15 +43,18 @@ sub photos {
my $id = $self->id;
my $typ = $self->result_source->name eq 'comment' ? 'c/' : '';
+ my $non_public = $self->result_source->name eq 'comment'
+ ? $self->problem->non_public : $self->non_public;
+
my @photos = map {
my $cachebust = substr($_, 0, 8);
# Some Varnish configurations (e.g. on mySociety infra) strip cookies from
# images, which means image requests will be redirected to the login page
- # if LOGIN_REQUIRED is set. To stop this happening, Varnish should be
+ # if e.g. LOGIN_REQUIRED is set. To stop this happening, Varnish should be
# configured to not strip cookies if the cookie_passthrough param is
# present, which this line ensures will be if LOGIN_REQUIRED is set.
my $extra = '';
- if (FixMyStreet->config('LOGIN_REQUIRED')) {
+ if (FixMyStreet->config('LOGIN_REQUIRED') || $non_public) {
$cachebust .= '&cookie_passthrough=1';
$extra = '?cookie_passthrough=1';
}
@@ -59,6 +67,7 @@ sub photos {
url_full => "/photo/$typ$id.$i.full.$format?$cachebust",
url_tn => "/photo/$typ$id.$i.tn.$format?$cachebust",
url_fp => "/photo/$typ$id.$i.fp.$format?$cachebust",
+ url_og => "/photo/$typ$id.$i.og.$format?$cachebust",
idx => $i++,
}
} $photoset->all_ids;