diff options
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Comment.pm | 6 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/State.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/SendReport/Email.pm | 5 | ||||
-rw-r--r-- | t/cobrand/isleofwight.t | 3 | ||||
-rw-r--r-- | t/cobrand/tfl.t | 22 |
5 files changed, 36 insertions, 4 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/perllib/FixMyStreet/DB/ResultSet/State.pm b/perllib/FixMyStreet/DB/ResultSet/State.pm index cb894005f..4f98efbf2 100644 --- a/perllib/FixMyStreet/DB/ResultSet/State.pm +++ b/perllib/FixMyStreet/DB/ResultSet/State.pm @@ -1,6 +1,7 @@ package FixMyStreet::DB::ResultSet::State; use base 'DBIx::Class::ResultSet'; +use utf8; use strict; use warnings; use Memcached; @@ -74,7 +75,8 @@ sub display { return $unchanging->{$label} if $unchanging->{$label}; if ($cobrand && $label eq 'not responsible') { return 'third party responsibility' if $cobrand eq 'bromley'; - return "not Island Roads' responsibility" if $cobrand eq 'isleofwight'; + return "not Island Roads’ responsibility" if $cobrand eq 'isleofwight'; + return "not TfL’s responsibility" if $cobrand eq 'tfl'; return _("not the council's responsibility"); } if ($cobrand && $cobrand eq 'oxfordshire' && $label eq 'unable to fix') { diff --git a/perllib/FixMyStreet/SendReport/Email.pm b/perllib/FixMyStreet/SendReport/Email.pm index 80b60b381..ffff43472 100644 --- a/perllib/FixMyStreet/SendReport/Email.pm +++ b/perllib/FixMyStreet/SendReport/Email.pm @@ -106,7 +106,10 @@ sub send { } my $result = FixMyStreet::Email::send_cron($row->result_source->schema, - $self->get_template($row), $h, + $self->get_template($row), { + %$h, + cobrand => $cobrand, # For correct logo that uses cobrand object + }, $params, $sender, $nomail, $cobrand, $row->lang); unless ($result) { diff --git a/t/cobrand/isleofwight.t b/t/cobrand/isleofwight.t index bd837b3c6..0c985e2fb 100644 --- a/t/cobrand/isleofwight.t +++ b/t/cobrand/isleofwight.t @@ -1,3 +1,4 @@ +use utf8; use CGI::Simple; use DateTime; use Test::MockModule; @@ -425,7 +426,7 @@ subtest "check not responsible as correct text" => sub { $mech->get_ok('/report/' . $p->id); }; - $mech->content_contains("not Island Roads' responsibility", "not reponsible message contains correct text"); + $mech->content_contains("not Island Roads’ responsibility", "not reponsible message contains correct text"); $p->comments->delete; $p->delete; }; diff --git a/t/cobrand/tfl.t b/t/cobrand/tfl.t index ef6ca087c..6b811beb4 100644 --- a/t/cobrand/tfl.t +++ b/t/cobrand/tfl.t @@ -422,6 +422,7 @@ for my $test ( FixMyStreet::Script::Reports::send(); my @email = $mech->get_email; is $email[0]->header('To'), $to, 'Sent to correct address'; + like $email[0]->as_string, qr/iEYI87gX6Upb\+tKYzrSmN83pTnv606AOtahHTepSm/, 'Right logo'; like $mech->get_text_body_from_email($email[0]), qr/https:\/\/street.tfl/, 'Correct link'; like $mech->get_text_body_from_email($email[1]), qr/$ref/, "Correct reference number in reporter email" if $ref; $mech->clear_emails_ok; @@ -818,6 +819,27 @@ FixMyStreet::override_config { }; 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(), + }); + 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 { ALLOWED_COBRANDS => 'bromley', MAPIT_URL => 'http://mapit.uk/' }, sub { |