From a6a83ebd853fda4b55cd720e406cd5ec952927b1 Mon Sep 17 00:00:00 2001 From: Moray Jones Date: Fri, 5 Jun 2026 16:19:33 +0100 Subject: [PATCH] [Canal] Remove categories from cobrands Whilst developing we don't want the categories showing on cobrands as causing confusion to other councils https://github.com/mysociety/societyworks/issues/5549 --- perllib/FixMyStreet/Cobrand/UKCouncils.pm | 6 ++++++ t/cobrand/camden.t | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm index c9ffe9000a5..3a4edf17bf5 100644 --- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm +++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm @@ -438,6 +438,12 @@ sub munge_report_new_bodies { %$bodies = map { $_->id => $_ } grep { $_->name ne 'Environment Agency' } values %$bodies; } + # Remove Canals and Rivers Trust from showing on Cobrands during development work + # Canals & River Trust overrides this function + if ( $bodies{'Canal & River Trust'} ) { + %$bodies = map { $_->id => $_ } grep { $_->name ne 'Canal & River Trust' } values %$bodies; + } + if ( $bodies{'Thamesmead'} ) { my $thamesmead = FixMyStreet::Cobrand::Thamesmead->new({ c => $self->{c} }); $thamesmead->munge_thamesmead_body($bodies); diff --git a/t/cobrand/camden.t b/t/cobrand/camden.t index 7d5c2b35b8f..c4d8fb74320 100644 --- a/t/cobrand/camden.t +++ b/t/cobrand/camden.t @@ -265,4 +265,18 @@ FixMyStreet::override_config { }; }; +FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'camden', 'tfl', 'canalrivertrust' ], + MAPIT_URL => 'http://mapit.uk/', +}, sub { + subtest 'cobrand does not show Canal and River trust categories' => sub { + my $canalsandriver = $mech->create_body_ok(CAMDEN_MAPIT_ID, 'Canal & River Trust'); + my $canal_contact = $mech->create_contact_ok(body_id => $canalsandriver->id, category => 'Polluted water', email => 'water@example.com'); + my $tree_contact = $mech->create_contact_ok(body_id => $camden->id, category => 'Trees', email => 'foo@camden'); + $mech->get_ok("/report/new/ajax?latitude=51.529432&longitude=-0.124514"); + $mech->content_contains('Trees'); + $mech->content_lacks('Polluted water'); + }; +}; + done_testing;