diff options
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Problem.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 114 |
1 files changed, 58 insertions, 56 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 2a90d0bec..12dad073e 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -531,6 +531,19 @@ sub is_visible { return exists $self->visible_states->{ $self->state } ? 1 : 0; } +=head2 state_display + +Returns a string suitable for display lookup in the update meta section. +Removes the '- council/user' bit from fixed states. + +=cut + +sub state_display { + my $self = shift; + (my $state = $self->state) =~ s/ -.*$//; + return $state; +} + =head2 meta_line Returns a string to be used on a problem report page, describing some of the @@ -544,59 +557,48 @@ sub meta_line { my $date_time = Utils::prettify_dt( $problem->confirmed ); my $meta = ''; - # FIXME Should be in cobrand - if ($c->cobrand->moniker eq 'emptyhomes') { - - my $category = _($problem->category); - utf8::decode($category); - $meta = sprintf(_('%s, reported at %s'), $category, $date_time); - - } else { - - if ( $problem->anonymous ) { - if ( $problem->service - and $problem->category && $problem->category ne _('Other') ) - { - $meta = - sprintf( _('Reported via %s in the %s category anonymously at %s'), - $problem->service, $problem->category, $date_time ); - } - elsif ( $problem->service ) { - $meta = sprintf( _('Reported via %s anonymously at %s'), - $problem->service, $date_time ); - } - elsif ( $problem->category and $problem->category ne _('Other') ) { - $meta = sprintf( _('Reported in the %s category anonymously at %s'), - $problem->category, $date_time ); - } - else { - $meta = sprintf( _('Reported anonymously at %s'), $date_time ); - } + if ( $problem->anonymous ) { + if ( $problem->service + and $problem->category && $problem->category ne _('Other') ) + { + $meta = + sprintf( _('Reported via %s in the %s category anonymously at %s'), + $problem->service, $problem->category, $date_time ); + } + elsif ( $problem->service ) { + $meta = sprintf( _('Reported via %s anonymously at %s'), + $problem->service, $date_time ); + } + elsif ( $problem->category and $problem->category ne _('Other') ) { + $meta = sprintf( _('Reported in the %s category anonymously at %s'), + $problem->category, $date_time ); } else { - if ( $problem->service - and $problem->category && $problem->category ne _('Other') ) - { - $meta = sprintf( - _('Reported via %s in the %s category by %s at %s'), - $problem->service, $problem->category, - $problem->name, $date_time - ); - } - elsif ( $problem->service ) { - $meta = sprintf( _('Reported via %s by %s at %s'), - $problem->service, $problem->name, $date_time ); - } - elsif ( $problem->category and $problem->category ne _('Other') ) { - $meta = sprintf( _('Reported in the %s category by %s at %s'), - $problem->category, $problem->name, $date_time ); - } - else { - $meta = - sprintf( _('Reported by %s at %s'), $problem->name, $date_time ); - } + $meta = sprintf( _('Reported anonymously at %s'), $date_time ); + } + } + else { + if ( $problem->service + and $problem->category && $problem->category ne _('Other') ) + { + $meta = sprintf( + _('Reported via %s in the %s category by %s at %s'), + $problem->service, $problem->category, + $problem->name, $date_time + ); + } + elsif ( $problem->service ) { + $meta = sprintf( _('Reported via %s by %s at %s'), + $problem->service, $problem->name, $date_time ); + } + elsif ( $problem->category and $problem->category ne _('Other') ) { + $meta = sprintf( _('Reported in the %s category by %s at %s'), + $problem->category, $problem->name, $date_time ); + } + else { + $meta = + sprintf( _('Reported by %s at %s'), $problem->name, $date_time ); } - } return $meta; @@ -647,14 +649,14 @@ sub response_templates { } # returns true if the external id is the council's ref, i.e., useful to publish it -# (by way of an example, the barnet send method returns a useful reference when +# (by way of an example, the Oxfordshire send method returns a useful reference when # it succeeds, so that is the ref we should show on the problem report page). # Future: this is installation-dependent so maybe should be using the contact # data to determine if the external id is public on a council-by-council basis. # Note: this only makes sense when called on a problem that has been sent! sub can_display_external_id { my $self = shift; - if ($self->external_id && $self->send_method_used && $self->bodies_str =~ /2237/) { + if ($self->external_id && $self->send_method_used && $self->bodies_str =~ /(2237|2550)/) { return 1; } return 0; @@ -862,12 +864,12 @@ sub photos { my $i = 0; my $id = $self->id; my @photos = map { - my $format = 'jpeg'; my $cachebust = substr($_, 0, 8); + my ($hash, $format) = split /\./, $_; { - id => $_, - url_temp => "/photo/$_.temp.$format", - url_temp_full => "/photo/$_.fulltemp.$format", + id => $hash, + url_temp => "/photo/temp.$hash.$format", + url_temp_full => "/photo/fulltemp.$hash.$format", url => "/photo/$id.$i.$format?$cachebust", url_full => "/photo/$id.$i.full.$format?$cachebust", url_tn => "/photo/$id.$i.tn.$format?$cachebust", |