aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2019-10-07 09:27:54 +0100
committerDave Arter <davea@mysociety.org>2019-10-07 11:55:33 +0100
commitc28e4164e53baa11b602ffedf2bb4bc617b0c00b (patch)
treec9137cb900d3a8fbffd8ac749c6c74fd17dec612
parent0ad08dfddf926227ab94e2342d378d6d5a52368d (diff)
[Westminster] Exclude .com updates
-rw-r--r--perllib/FixMyStreet/Cobrand/Westminster.pm9
-rw-r--r--t/cobrand/westminster.t24
2 files changed, 32 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Westminster.pm b/perllib/FixMyStreet/Cobrand/Westminster.pm
index b3ab35b7b..8adb7eb2c 100644
--- a/perllib/FixMyStreet/Cobrand/Westminster.pm
+++ b/perllib/FixMyStreet/Cobrand/Westminster.pm
@@ -153,4 +153,13 @@ sub categories_restriction {
}, { join => 'body' });
}
+sub updates_restriction {
+ my $self = shift;
+
+ # Westminster don't want any fms.com updates shown on their cobrand.
+ return $self->next::method(@_)->search({
+ "me.cobrand" => { '!=', 'fixmystreet' }
+ });
+}
+
1;
diff --git a/t/cobrand/westminster.t b/t/cobrand/westminster.t
index cadd6b18d..303401de6 100644
--- a/t/cobrand/westminster.t
+++ b/t/cobrand/westminster.t
@@ -23,7 +23,14 @@ my $staff_user = $mech->create_user_ok(
name => 'Test User',
from_body => $body
);
+my $normal_user = $mech->create_user_ok(
+ 'westminster-resident@example.com',
+ name => 'Public User'
+);
my ($report) = $mech->create_problems_for_body(1, $body->id, 'Title');
+my $comment1 = $mech->create_comment_for_problem($report, $normal_user, 'User', 'this update was left on the Westminster cobrand', 0, 'confirmed', 'confirmed', { cobrand => 'westminster' });
+my $comment2 = $mech->create_comment_for_problem($report, $normal_user, 'User', 'this update was left on the fixmystreet.com cobrand', 0, 'confirmed', 'confirmed', { cobrand => 'fixmystreet' });
+my $comment3 = $mech->create_comment_for_problem($report, $normal_user, 'User', 'this update was imported via Open311', 0, 'confirmed', 'confirmed', { cobrand => '' });
FixMyStreet::override_config {
ALLOWED_COBRANDS => 'westminster',
@@ -57,6 +64,21 @@ FixMyStreet::override_config {
$mech->get_ok('/report/' . $report->id);
$mech->content_lacks('Provide an update');
};
+
+ subtest 'Reports show updates from Westminster cobrand' => sub {
+ $mech->get_ok('/report/' . $report->id);
+ $mech->content_contains($comment1->text);
+ };
+
+ subtest 'Reports show updates from Open311' => sub {
+ $mech->get_ok('/report/' . $report->id);
+ $mech->content_contains($comment3->text);
+ };
+
+ subtest 'Reports don’t show updates from fixmystreet.com cobrand' => sub {
+ $mech->get_ok('/report/' . $report->id);
+ $mech->content_lacks($comment2->text);
+ };
};
subtest 'Reports have an update form for superusers' => sub {
@@ -140,7 +162,7 @@ for (
};
}
-FixMyStreet::DB->resultset('Problem')->delete_all;
+$mech->delete_problems_for_body($body->id);
$mech->create_contact_ok(body_id => $body->id, category => 'Abandoned bike', email => "BIKE");
($report) = $mech->create_problems_for_body(1, $body->id, 'Bike', {
category => "Abandoned bike", cobrand => 'westminster',