diff options
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Comment.pm | 6 | ||||
-rw-r--r-- | t/cobrand/tfl.t | 16 |
2 files changed, 17 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm index 99c5b6dab..bac183271 100644 --- a/perllib/FixMyStreet/DB/Result/Comment.pm +++ b/perllib/FixMyStreet/DB/Result/Comment.pm @@ -278,7 +278,11 @@ sub problem_state_display { return '' unless $state; my $cobrand_name = $c->cobrand->moniker; - $cobrand_name = 'bromley' if $self->problem->to_body_named('Bromley'); + my $names = join(',,', @{$self->problem->body_names}); + if ($names =~ /(Bromley|Isle of Wight|TfL)/) { + ($cobrand_name = lc $1) =~ s/ //g; + } + return FixMyStreet::DB->resultset("State")->display($state, 1, $cobrand_name); } diff --git a/t/cobrand/tfl.t b/t/cobrand/tfl.t index 9624a6aae..5b4f733c7 100644 --- a/t/cobrand/tfl.t +++ b/t/cobrand/tfl.t @@ -813,19 +813,27 @@ FixMyStreet::override_config { $staffuser->unset_extra_metadata('2fa_secret'); $staffuser->update; }; +}; - subtest "check not responsible as correct text" => sub { +FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'fixmystreet', 'tfl' ], + MAPIT_URL => 'http://mapit.uk/' +}, sub { + foreach (qw(tfl.fixmystreet.com fixmystreet.com)) { + $mech->host($_); my ($p) = $mech->create_problems_for_body(1, $body->id, 'NotResp'); my $c = FixMyStreet::DB->resultset('Comment')->create({ problem => $p, user => $p->user, anonymous => 't', text => 'Update text', problem_state => 'not responsible', state => 'confirmed', mark_fixed => 0, confirmed => DateTime->now(), }); - $mech->get_ok('/report/' . $p->id); - $mech->content_contains("not TfL’s responsibility", "not reponsible message contains correct text"); + subtest "check not responsible as correct text on $_" => sub { + $mech->get_ok('/report/' . $p->id); + $mech->content_contains("not TfL’s responsibility", "not reponsible message contains correct text"); + }; $p->comments->delete; $p->delete; - }; + } }; FixMyStreet::override_config { |