Skip to content

Commit 5c5a759

Browse files
[FMS] Make sure /reports link for Kingston work
Rather than directing back to the dashboard page. We already had checks for Bexley & Greenwich, whose full names start with 'London|Royal Borough of'; we needed a check for Kingston upon Thames as well.
1 parent e0a2fea commit 5c5a759

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

perllib/FixMyStreet/Cobrand/UK.pm

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ sub short_name {
127127
return $name;
128128
}
129129

130+
sub is_london_or_royal {
131+
my ( $self, $short_name ) = @_;
132+
133+
return $short_name =~ /bexley|greenwich|kingston/i;
134+
}
135+
130136
sub find_closest {
131137
my ($self, $data) = @_;
132138

@@ -149,9 +155,8 @@ sub find_closest {
149155

150156
sub reports_body_check {
151157
my ( $self, $c, $code ) = @_;
152-
153-
# Deal with Bexley and Greenwich name not starting with short name
154-
if ($code =~ /bexley|greenwich/i) {
158+
# Some full names do not start with short name
159+
if ( $self->is_london_or_royal($code) ) {
155160
my $body = $c->model('DB::Body')->search( { name => { -like => "%$code%" } } )->single;
156161
$c->stash->{body} = $body;
157162
return $body;

perllib/FixMyStreet/Cobrand/UKCouncils.pm

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,8 @@ sub all_reports_single_body {
251251

252252
sub reports_body_check {
253253
my ( $self, $c, $code ) = @_;
254-
255-
# Deal with Bexley/Greenwich name not starting with short name
256-
if ($code =~ /bexley|greenwich/i) {
254+
# Some full names do not start with short name
255+
if ( $self->is_london_or_royal($code) ) {
257256
my $body = $c->model('DB::Body')->search( { name => { -like => "%$code%" } } )->single;
258257
$c->stash->{body} = $body;
259258
return $body;

0 commit comments

Comments
 (0)