aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2019-09-03 12:18:58 +0100
committerStruan Donald <struan@exo.org.uk>2019-09-27 17:35:15 +0100
commitf4f91a6d0d93bc7dc87f4458ed0322f11a8711c0 (patch)
tree5c13c077875417cef55a82c85abe97d0c775773b
parentc2eb45cb6ad6d0366e51f31ecedc7cea91782892 (diff)
[IsleOfWight] display Island Roads for moderation user
-rw-r--r--perllib/FixMyStreet/DB/Result/User.pm6
-rw-r--r--t/cobrand/isleofwight.t26
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');