Skip to content

Commit

Permalink
[Merton] Hide TfL River Piers categories
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismytton committed Dec 4, 2023
1 parent 0047d8d commit f77895e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
12 changes: 12 additions & 0 deletions perllib/FixMyStreet/Cobrand/Merton.pm
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,16 @@ sub report_age { '3 months' }

sub abuse_reports_only { 1 }

=head2 categories_restriction
Hide TfL's River Piers categories on the Merton cobrand.
=cut

sub categories_restriction {
my ($self, $rs) = @_;

return $rs->search( { 'me.category' => { -not_like => 'River Piers%' } } );
}

1;
14 changes: 13 additions & 1 deletion t/cobrand/merton.t
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@ my ($problem2) = $mech->create_problems_for_body(1, $hackney->id, 'Title', {


FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'merton' ],
ALLOWED_COBRANDS => [ 'merton', 'tfl' ],
MAPIT_URL => 'http://mapit.uk/',
COBRAND_FEATURES => {
anonymous_account => {
merton => 'anonymous'
},
},
}, sub {
ok $mech->host('merton.fixmystreet.com'), 'set host';

subtest 'cobrand homepage displays council name' => sub {
$mech->get_ok('/');
Expand Down Expand Up @@ -118,6 +119,17 @@ FixMyStreet::override_config {

$mech->not_logged_in_ok;
};

subtest "hides the TfL River Piers category" => sub {
my $tfl = $mech->create_body_ok(2500, 'TfL');
$mech->create_contact_ok(body_id => $tfl->id, category => 'River Piers', email => '[email protected]');
$mech->create_contact_ok(body_id => $tfl->id, category => 'River Piers - Cleaning', email => '[email protected]');
$mech->create_contact_ok(body_id => $tfl->id, category => 'River Piers Damage doors and glass', email => '[email protected]');

my $json = $mech->get_ok_json('/report/new/ajax?latitude=51.400975&longitude=-0.19655');
my $categories = [sort keys %{$json->{by_category}}];
is_deeply $categories, ['Litter', 'Other', 'Potholes', 'Traffic lights'], "Merton doesn't have any River Piers categories";
};
};

subtest 'only Merton staff can reopen closed reports on Merton cobrand' => sub {
Expand Down

0 comments on commit f77895e

Please sign in to comment.