diff options
-rw-r--r-- | perllib/FixMyStreet/DB/Result/User.pm | 6 | ||||
-rw-r--r-- | t/cobrand/isleofwight.t | 26 |
2 files changed, 31 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm index 51f959e0e..85fdc790b 100644 --- a/perllib/FixMyStreet/DB/Result/User.pm +++ b/perllib/FixMyStreet/DB/Result/User.pm @@ -317,7 +317,11 @@ sub body { sub moderating_user_name { my $self = shift; - return $self->body || _('an administrator'); + my $body = $self->body; + if ( $body && $body eq 'Isle of Wight Council' ) { + $body = 'Island Roads'; + } + return $body || _('an administrator'); } =head2 belongs_to_body diff --git a/t/cobrand/isleofwight.t b/t/cobrand/isleofwight.t index ddca0b97c..42d5d43ba 100644 --- a/t/cobrand/isleofwight.t +++ b/t/cobrand/isleofwight.t @@ -23,6 +23,11 @@ my $contact = $mech->create_contact_ok( ); my $user = $mech->create_user_ok('user@example.org'); +my $iow_user = $mech->create_user_ok('iow_user@example.org', from_body => $isleofwight); +$iow_user->user_body_permissions->create({ + body => $isleofwight, + permission_type => 'moderate', +}); my @reports = $mech->create_problems_for_body(1, $isleofwight->id, 'An Isle of wight report', { confirmed => '2019-05-25 09:00', @@ -71,6 +76,27 @@ subtest "only original reporter can comment" => sub { }; }; +subtest "check moderation label uses correct name" => sub { + my $REPORT_URL = '/report/' . $reports[0]->id; + FixMyStreet::override_config { + MAPIT_URL => 'http://mapit.uk/', + ALLOWED_COBRANDS => ['isleofwight'], + }, sub { + $mech->log_out_ok; + $mech->log_in_ok( $iow_user->email ); + $mech->get_ok($REPORT_URL); + $mech->content_lacks('show-moderation'); + $mech->follow_link_ok({ text_regex => qr/^Moderate$/ }); + $mech->content_contains('show-moderation'); + $mech->submit_form_ok({ with_fields => { + problem_title => 'Good good', + problem_detail => 'Good good improved', + }}); + $mech->base_like( qr{\Q$REPORT_URL\E} ); + $mech->content_like(qr/Moderated by Island Roads/); + }; +}; + $_->delete for @reports; my $system_user = $mech->create_user_ok('system_user@example.org'); |