diff options
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 8 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 7062f481f..df4dc5f77 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -221,9 +221,15 @@ sub format_problem_for_display : Private { if ( $c->stash->{ajax} ) { $c->res->content_type('application/json; charset=utf-8'); + + # encode_json doesn't like DateTime objects, so strip them out + my $report_hashref = $c->cobrand->problem_as_hashref( $problem, $c ); + delete $report_hashref->{created}; + delete $report_hashref->{confirmed}; + my $content = encode_json( { - report => $c->cobrand->problem_as_hashref( $problem, $c ), + report => $report_hashref, updates => $c->cobrand->updates_as_hashref( $problem, $c ), } ); diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 7068d3b03..c8af63987 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -174,7 +174,7 @@ sub updates_as_hashref { my $hashref = {}; - if (problem_has_public_response($problem)) { + if ($self->problem_has_public_response($problem)) { $hashref->{update_pp} = $self->prettify_dt( $problem->lastupdate ); if ( $problem->state ne 'external' ) { |