diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-07-23 17:07:41 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-07-23 17:07:41 +0100 |
commit | 7aa879d03334c4092d60d5f39443ad9b2405bac5 (patch) | |
tree | 2b306fa277c394e5b7545df742e60d9467a33906 | |
parent | 95d4d488e8e409e9646ab24731a50ee2846d68c3 (diff) |
Don't show postcode column in RSS/alert emails, may have no bearing on report.
-rwxr-xr-x | perllib/FixMyStreet/App/Controller/Rss.pm | 5 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/AlertType.pm | 8 | ||||
-rw-r--r-- | t/app/controller/alert_new.t | 2 | ||||
-rw-r--r-- | t/app/controller/rss.t | 11 | ||||
-rw-r--r-- | t/app/model/alert_type.t | 65 |
5 files changed, 20 insertions, 71 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Rss.pm b/perllib/FixMyStreet/App/Controller/Rss.pm index 4bec33057..62a889801 100755 --- a/perllib/FixMyStreet/App/Controller/Rss.pm +++ b/perllib/FixMyStreet/App/Controller/Rss.pm @@ -254,11 +254,6 @@ sub add_row : Private { } my $url = $base_url . $link; - if ( $row->{postcode} ) { - my $pc = $c->cobrand->format_postcode( $row->{postcode} ); - $title .= ", $pc"; - } - my %item = ( title => ent($title), link => $url, diff --git a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm index 5231d01ef..a0320ccc3 100644 --- a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm +++ b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm @@ -96,9 +96,7 @@ sub email_alerts ($) { $data{data} .= $row->{item_text} . "\n\n------\n\n"; # this is ward and council problems } else { - my $postcode = $cobrand->format_postcode( $row->{postcode} ); - $postcode = ", $postcode" if $postcode; - $data{data} .= $url . "/report/" . $row->{id} . " - $row->{title}$postcode\n\n"; + $data{data} .= $url . "/report/" . $row->{id} . " - $row->{title}\n\n"; if ( exists $row->{geocode} && $row->{geocode} && $ref =~ /ward|council/ ) { my $nearest_st = _get_address_from_gecode( $row->{geocode} ); $data{data} .= $nearest_st if $nearest_st; @@ -168,9 +166,7 @@ sub email_alerts ($) { if ( $hashref_restriction && $hashref_restriction->{council} && $row->{council} ne $hashref_restriction->{council} ) { $url = mySociety::Config::get('BASE_URL'); } - my $postcode = $cobrand->format_postcode( $row->{postcode} ); - $postcode = ", $postcode" if $postcode; - $data{data} .= $url . "/report/" . $row->{id} . " - $row->{title}$postcode\n\n"; + $data{data} .= $url . "/report/" . $row->{id} . " - $row->{title}\n\n"; if ( exists $row->{geocode} && $row->{geocode} ) { my $nearest_st = _get_address_from_gecode( $row->{geocode} ); $data{data} .= $nearest_st if $nearest_st; diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t index 7ba887824..d66590c57 100644 --- a/t/app/controller/alert_new.t +++ b/t/app/controller/alert_new.t @@ -448,7 +448,7 @@ subtest "Test normal alert signups and that alerts are sent" => sub { $count++ if $_->body =~ /The following updates have been left on this problem:/; $count++ if $_->body =~ /The following new problems have been reported to City of\s*Edinburgh Council:/; $count++ if $_->body =~ /The following nearby problems have been added:/; - $count++ if $_->body =~ /\s+-\s+Testing,\s+EH1\s+1BB/; + $count++ if $_->body =~ /\s+-\s+Testing/; } is $count, 5, 'Five emails with the right things in them'; diff --git a/t/app/controller/rss.t b/t/app/controller/rss.t index c6ab20574..77e2c7ee1 100644 --- a/t/app/controller/rss.t +++ b/t/app/controller/rss.t @@ -41,7 +41,7 @@ my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( { $mech->get_ok("/rss/pc/EH11BB/2"); -$mech->content_contains( "Testing, 10th October, EH1 1BB" ); +$mech->content_contains( "Testing, 10th October" ); $mech->content_lacks( 'Nearest road to the pin' ); $report->geocode( @@ -106,19 +106,12 @@ $report->geocode( 'authenticationResultCode' => 'ValidCredentials' } ); -$report->postcode('eh11bb'); $report->update(); $mech->get_ok("/rss/pc/EH11BB/2"); -$mech->content_contains( "Testing, 10th October, EH1 1BB" ); +$mech->content_contains( "Testing, 10th October" ); $mech->content_contains( '18 North Bridge, Edinburgh' ); -$report->postcode('Princes St, Edinburgh'); -$report->update(); - -$mech->get_ok("/rss/pc/EH11BB/2"); -$mech->content_contains( "Testing, 10th October, Princes St, Edinburgh" ); - $report->delete(); $user1->delete(); diff --git a/t/app/model/alert_type.t b/t/app/model/alert_type.t index 272ad4900..7df4c44c0 100644 --- a/t/app/model/alert_type.t +++ b/t/app/model/alert_type.t @@ -155,59 +155,24 @@ my $council_alert = FixMyStreet::App->model('DB::Alert')->find_or_create( } ); -for my $test ( - { - postcode => 'SW1A 1AA', - expected_postcode => 'SW1A 1AA', - }, - { - postcode => 'sw1a 1AA', - expected_postcode => 'SW1A 1AA', - }, - { - postcode => 'SW1A 1aa', - expected_postcode => 'SW1A 1AA', - }, - { - postcode => 'SW1A1AA', - expected_postcode => 'SW1A 1AA', - }, - { - postcode => 'Buckingham Gate', - expected_postcode => 'Buckingham\s+Gate', - }, - { - postcode => 'Buckingham gate', - expected_postcode => 'Buckingham\s+gate', - }, -) { - subtest "correct text for postcode $test->{postcode}" => sub { - $mech->clear_emails_ok; - - my $sent = FixMyStreet::App->model('DB::AlertSent')->search( - { - alert_id => $council_alert->id, - parameter => $report->id, - } - )->delete; - - $report->postcode( $test->{postcode} ); - $report->update; - - FixMyStreet::App->model('DB::AlertType')->email_alerts(); +subtest "correct text for title after URL" => sub { + $mech->clear_emails_ok; - $mech->email_count_is( 1 ); - my $email = $mech->get_email; - my $pc = $test->{expected_postcode}; - (my $title = $report->title) =~ s/ /\\s+/; - my $body = $email->body; + my $sent = FixMyStreet::App->model('DB::AlertSent')->search( + { + alert_id => $council_alert->id, + parameter => $report->id, + } + )->delete; + FixMyStreet::App->model('DB::AlertType')->email_alerts(); - like $body, qr#report/$report_id\s+-\s+$title,\s+$pc#, 'email contains expected postcode'; - }; -} + $mech->email_count_is( 1 ); + my $email = $mech->get_email; + (my $title = $report->title) =~ s/ /\\s+/; + my $body = $email->body; -$report->postcode( 'SW1A 1AA' ); -$report->update; + like $body, qr#report/$report_id\s+-\s+$title#, 'email contains expected title'; +}; $report->geocode( { |