diff options
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Comment.pm | 5 | ||||
-rw-r--r-- | t/app/controller/report_updates.t | 13 |
2 files changed, 17 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm index 26ba89fda..cf1ba444d 100644 --- a/perllib/FixMyStreet/DB/Result/Comment.pm +++ b/perllib/FixMyStreet/DB/Result/Comment.pm @@ -292,7 +292,10 @@ sub meta_line { $update_state = _( 'marked as an internal referral' ) } - if ($c->cobrand->moniker eq 'bromley' || $self->problem->bodies_str eq '2482') { + if ($c->cobrand->moniker eq 'bromley' || ( + $self->problem->bodies_str && + $self->problem->bodies_str eq '2482' + )) { if ($state eq 'not responsible') { $update_state = 'marked as third party responsibility' } diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 41d181e65..de153978b 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -131,6 +131,19 @@ for my $test ( }; } +subtest "updates displayed on report with empty bodies_str" => sub { + my $old_bodies_str = $report->bodies_str; + $report->update({ bodies_str => undef }); + $comment->update({ problem_state => 'fixed' , mark_open => 'false', mark_fixed => 'false' }); + + $mech->get_ok("/report/$report_id"); + + my $meta = $mech->extract_update_metas; + is scalar @$meta, 1, 'update displayed'; + + $report->update({ bodies_str => $old_bodies_str }); +}; + subtest "unconfirmed updates not displayed" => sub { $comment->state( 'unconfirmed' ); $comment->update; |