aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-11-29 15:35:19 +0000
committerStruan Donald <struan@exo.org.uk>2011-11-29 15:35:19 +0000
commitd4fbdc003253456acade79af4b5e1fcdae34ce02 (patch)
tree90695c56f3a9e7fa12c858b712306daa7499da17
parentb8813503550d4adc8c88a0ee0f15b23128274e01 (diff)
canonicalise postcode for display in RSS titles
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Rss.pm5
-rw-r--r--t/app/controller/rss.t3
2 files changed, 6 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Rss.pm b/perllib/FixMyStreet/App/Controller/Rss.pm
index 20c839208..3a0fa0c04 100755
--- a/perllib/FixMyStreet/App/Controller/Rss.pm
+++ b/perllib/FixMyStreet/App/Controller/Rss.pm
@@ -252,7 +252,10 @@ sub add_row : Private {
my $url = $c->uri_for( $link );
if ( $row->{postcode} ) {
- $title .= ", $row->{postcode}";
+ my $pc = $row->{postcode};
+ $pc = mySociety::PostcodeUtil::canonicalise_postcode($pc)
+ if mySociety::PostcodeUtil::is_valid_postcode($pc);
+ $title .= ", $pc";
}
my %item = (
diff --git a/t/app/controller/rss.t b/t/app/controller/rss.t
index 39a7db5bc..a820a9586 100644
--- a/t/app/controller/rss.t
+++ b/t/app/controller/rss.t
@@ -16,7 +16,7 @@ my $user1 = FixMyStreet::App->model('DB::User')
->find_or_create( { email => 'reporter@example.com', name => 'Reporter User' } );
my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( {
- postcode => 'EH1 1BB',
+ postcode => 'eh1 1BB',
council => '2651',
areas => ',11808,135007,14419,134935,2651,20728,',
category => 'Street lighting',
@@ -106,6 +106,7 @@ $report->geocode(
'authenticationResultCode' => 'ValidCredentials'
}
);
+$report->postcode('eh11bb');
$report->update();
$mech->get_ok("/rss/pc/EH11BB/2");