diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/Template/SafeString.pm | 6 | ||||
-rw-r--r-- | t/cobrand/zurich.t | 9 |
3 files changed, 17 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 7dfda1a4c..7168e8379 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -299,7 +299,8 @@ sub format_problem_for_display : Private { delete $report_hashref->{created}; delete $report_hashref->{confirmed}; - my $content = encode_json( + my $json = JSON::MaybeXS->new( convert_blessed => 1, utf8 => 1 ); + my $content = $json->encode( { report => $report_hashref, updates => $c->cobrand->updates_as_hashref( $problem, $c ), diff --git a/perllib/FixMyStreet/Template/SafeString.pm b/perllib/FixMyStreet/Template/SafeString.pm index 619bee048..263937b39 100644 --- a/perllib/FixMyStreet/Template/SafeString.pm +++ b/perllib/FixMyStreet/Template/SafeString.pm @@ -69,6 +69,12 @@ sub clone { return $clone; } +sub TO_JSON { + my $self = shift; + + return $$self; +} + 1; __END__ diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t index f2dd754f1..0a144de23 100644 --- a/t/cobrand/zurich.t +++ b/t/cobrand/zurich.t @@ -118,6 +118,15 @@ my $json = $mech->get_ok_json( '/report/ajax/' . $report->id ); is $json->{report}->{title}, "Überprüfung ausstehend", "correct title"; is $json->{report}->{state}, "submitted", "correct state"; +$report->state('fixed - council'); +$report->set_extra_metadata(public_response => 'Freundliche Grüsse'); +$report->update; +$json = $mech->get_ok_json( '/report/ajax/' . $report->id ); +is $json->{report}->{state}, "closed", "correct state"; +is $json->{updates}->{details}, "Freundliche Grüsse", "correct public response"; + +$report->update({ state => 'submitted' }); + subtest "Banners are displayed correctly" => sub { for my $test ( { |