aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/Cobrand/Hounslow.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/UKCouncils.pm6
-rw-r--r--t/cobrand/hounslow.t14
3 files changed, 18 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Hounslow.pm b/perllib/FixMyStreet/Cobrand/Hounslow.pm
index 18063c4aa..93512f2b9 100644
--- a/perllib/FixMyStreet/Cobrand/Hounslow.pm
+++ b/perllib/FixMyStreet/Cobrand/Hounslow.pm
@@ -16,7 +16,7 @@ sub enter_postcode_text {
return "Enter a Hounslow street name and area, or postcode";
}
-sub admin_user_domain { 'hounslowhighways.org' }
+sub admin_user_domain { ('hounslowhighways.org', 'hounslow.gov.uk') }
sub disambiguate_location {
my $self = shift;
diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm
index 1fe346e43..794c3dec6 100644
--- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm
+++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm
@@ -102,8 +102,10 @@ sub users_restriction {
'me.id' => [ { -in => $problem_user_ids }, { -in => $update_user_ids } ],
];
if ($self->can('admin_user_domain')) {
- my $domain = $self->admin_user_domain;
- push @$or_query, email => { ilike => "%\@$domain" };
+ my @domains = $self->admin_user_domain;
+ @domains = map { { ilike => "%\@$_" } } @domains;
+ @domains = [ @domains ] if @domains > 1;
+ push @$or_query, email => @domains;
}
return $rs->search($or_query);
diff --git a/t/cobrand/hounslow.t b/t/cobrand/hounslow.t
index 43a5a5523..cb67ad397 100644
--- a/t/cobrand/hounslow.t
+++ b/t/cobrand/hounslow.t
@@ -9,7 +9,8 @@ $mech->create_contact_ok(
email => 'pothole@example.org',
);
-$mech->create_user_ok('staff@example.org', from_body => $hounslow_id);
+my $user = $mech->create_user_ok('staff@example.org', from_body => $hounslow_id);
+$user->user_body_permissions->create({ body_id => $hounslow_id, permission_type => 'user_edit' });
my $tfl = $mech->create_body_ok( 2483, 'TfL');
$mech->create_contact_ok(
@@ -96,4 +97,15 @@ subtest "Shows external ID on report page to staff users only" => sub {
};
};
+subtest "Admin searches right domains" => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => 'hounslow',
+ }, sub {
+ foreach ('hounslowhighways.org', 'hounslow.gov.uk') {
+ $mech->get_ok('/admin/users?search=xyz@' . $_);
+ $mech->content_contains('xyz@' . $_);
+ }
+ };
+};
+
done_testing();