Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions perllib/FixMyStreet/Cobrand/CanalRiverTrust.pm
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ sub example_places { ['Lock 47, Fazeley', 'Bridge 33, Kennet and Avon'] }
sub admin_user_domain { 'canalrivertrust.org.uk' }
sub abuse_reports_only { 1 }

=item * Uses its own privacy policy

=cut

sub privacy_policy_url {
'https://canalrivertrust.org.uk/the-publication-scheme/making-a-request-for-information/privacy-notice'
}

=item * Include all reports in duplicate spotting, not just open ones

=cut

sub around_nearby_filter {
my ($self, $params) = @_;

delete $params->{states};
}

sub fetch_area_children {
my $self = shift;

Expand All @@ -61,6 +79,8 @@ sub fetch_area_children {
return $areas;
}

=back

=head2 Report categories

There is special handling of body/contacts; categories must end "(CRT)"
Expand Down
100 changes: 100 additions & 0 deletions t/cobrand/canalrivertrust.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
use FixMyStreet::TestMech;

FixMyStreet::App->log->disable('info');
END { FixMyStreet::App->log->enable('info'); }

my $mech = FixMyStreet::TestMech->new;
my $cobrand = FixMyStreet::Cobrand::CanalRiverTrust->new;
my $body = $mech->create_body_ok(
2226, # Same as for Gloucestershire for testing purposes
'Canal & River Trust',
{ send_method => 'Email',
cobrand => 'canalrivertrust',
},
);

my $bad_boat = $mech->create_contact_ok(
body_id => $body->id,
category => 'Bad boat (CRT)',
email => 'bad_boat@crt.dev',
);

my $standard_user_1
= $mech->create_user_ok( 'user1@email.com', name => 'User 1' );
my $standard_user_2
= $mech->create_user_ok( 'user2@email.com', name => 'User 2' );
my $staff_user = $mech->create_user_ok(
'staff@email.com',
name => 'Staff User',
from_body => $body,
);

FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'fixmystreet', 'canalrivertrust' ],
MAPIT_URL => 'http://mapit.uk/',
STAGING_FLAGS => { skip_must_have_2fa => 1 },
COBRAND_FEATURES => {
update_states_disallowed => {
canalrivertrust => 1,
fixmystreet => {
'Canal & River Trust' => 1,
},
},
updates_allowed => {
canalrivertrust => 'open/staff',
fixmystreet => {
'Canal & River Trust' => 'open/staff',
}
},
},
}, sub {
my ($report) = $mech->create_problems_for_body(
1,
$body->id,
'My report',
{ cobrand => 'canalrivertrust',
user => $standard_user_1,
category => 'Bad boat',
},
);

for my $host ( qw/fixmystreet canalrivertrust/ ) {
ok $mech->host($host), "change host to $host";

for my $user ( undef, $standard_user_1, $standard_user_2, $staff_user ) {
$user ? $mech->log_in_ok( $user->email ) : $mech->log_out_ok;

# Anyone can leave an update on an open report
$report->update( { state => 'in progress' } );

$mech->get_ok( '/report/' . $report->id );
$mech->content_contains( 'Provide an update',
'Can leave update on open report' );

# Nobody can mark report as fixed
$mech->content_lacks( 'This problem has been fixed',
'Cannot mark report as fixed' );

# No option to reopen report
$report->update( { state => 'fixed' } );

$mech->get_ok( '/report/' . $report->id );
$mech->content_lacks(
'This problem has not been fixed',
'No option to reopen report',
);

# Only staff can leave update on closed report
$mech->get_ok( '/report/' . $report->id );
if ( $user && $user->email eq $staff_user->email ) {
$mech->content_contains( 'Provide an update',
'Can leave update on closed report' );
} else {
$mech->content_lacks( 'Provide an update',
'Cannot leave update on closed report' );
}
}
}
};

done_testing();
2 changes: 1 addition & 1 deletion templates/web/canalrivertrust/footer_extra.html
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@
<nav aria-label="Policy">
<ul role="menubar" id="menu-policy" aria-label="Policy">
<li role="presentation" class="first">
<a href="https://canalrivertrust.org.uk/the-publication-scheme/making-a-request-for-information/privacy-notice" role="menuitem">Privacy Notice and Cookies</a>
<a href="[% c.cobrand.privacy_policy_url %]" role="menuitem">Privacy Notice and Cookies</a>
</li>
<li role="presentation">
<a href="https://canalrivertrust.org.uk/terms-and-conditions" role="menuitem">Terms &amp; conditions</a>
Expand Down
Loading